I have created a silverlight 2 app with an asp.net website. The website hosts the silverlight page and a silverlight-centric WCF service. In the silverlight project I added a WCF service reference to the website.
In visual studio everything works perfectly.
However, if I work on the same solution in Blend, and then press f5 to run there is a problem connecting to the WCF service. I was suprised by this because I could see the development server fire up in the windows taskbar. However, when I look at the properties of the development server instance, it isnt the same as the one in visual studio + it running on a different port number, which is why it couldnt connect to the WCF service.
I tried to get around this by changing the port number in the visual studio project to match that used by the blend development webserver and updated my web reference. When I tried again to run my silverlight app it broke completely, and I had to clear my browser chache to get things running again.
My question is - how do we develop on both VS2008 and Blend concurrently (including running the solution from either app) when including WCF services as part of the solution.
Any ideas would be great
Smells like a cross domain issue. Try putting a clientaccesspolicy.xml file in the root of your web project, allowing access from all other domains (you'll probably want to restrict this when you move it into production).
- <access-policy> - <cross-domain-access> - <policy> - <allow-from http-request-headers="*"> <domain uri="*" /> </allow-from> - <grant-to> <resource path="/" include-subpaths="true" /> </grant-to> </policy> </cross-domain-access> </access-policy>
Thanks for the reply, but I not sure that thats the issue
When you press f5 in blend it doesnt start the development webserver that you have configured in the visual studio project, but it's own proprietory development webserver, which runs on a completely different TCP port. The WCF service is configured as per the VS project configuration - which is therefore wrong. If you then configure the tcp port in the project to match the blend webserver port (so that the WCF reference is correct) the whole thing crashes.
Even if you applied the cross domain fix so that the blend running app could talk the the visual studio weberver, you still have the problem that blend only starts its own webserver, and wont automatically start the one configured in visual studio.
It seems the only way to run silverlight from blend that has a dependency on a WCF service is to get the webserver running in visual studio and then switch to blend and run the app in blend (assuming youve also implemented the cross domain fix)
I cant believe it's this difficult to do this in blend
I commited to learning blend, but it looks like im restricted to doing all of my development in VS2008.
Any other ideas ?
Me too - Im a die-hard VS coder, but Im keen to learn Blend because it is advised that you develop in both concurrently. Trouble is its too tempting to just hack your xaml in VS using intellisense.
I used Kaxaml editor before I got Blend, but I need to get good blend skills.
With respect to my problem, Ive used it as an excuse to spend time upgrading my laptop to vista ultimate, and installing full-on IIS7 - which will give me a single service endpoint to point to. I havent tried it yet but I'm confident that it'll fix my issues.