开发者

How do I debug a Silverlight application against a deployed service [cross domain problem]?

开发者 https://www.devze.com 2022-12-24 19:24 出处:网络
I have a WCF service and a Silverlight application that work just fine when they\'re deployed to the IIS server.

I have a WCF service and a Silverlight application that work just fine when they're deployed to the IIS server.

I want to debug the Silverlight application in Visual Studio on a development machine, but have it talk to the actual service deployed on the server, not to a local instance of it on the development machine.

I was expecting to simply be able to hit F5 in Visual Studio. Of course, I get a 4004 exception, comp开发者_StackOverflow中文版laining that the service URL (http://iisserver/.../service.svc) is being accessed in a cross-domain way.

On the domain root (http://iisserver/) I placed wide-open crossdomain.xml and clientaccesspolicy.xml files. I still get the exception.

When I look at the HTTP traffic in Web Development Helper or MS Network Monitor, I see NO REQUESTS to the server for either of the cross domain files.

What am I missing here?


One option (if you don't want to figure out why it's not getting to the correct service) is to launch the Silverlight app from the remote IIS server, and then, from within Visual Studio, with the appropriate Silverlight solution loaded, attach to the browser process you want to debug (Debug/Attach to Process). You can then set breakpoints or whatever else you need to do. And as an FYI, if you're using Internet Explorer, you'll note that there are two iexplore.exe processes. Attach to the one that has "Silverlight" as a debugger option.

The alternative is to figure out why your local client isn't calling the remote server, but that can be pretty involved. I presume you've already checked your code and configuration to make sure that it's actually pointing to the server and ports you want it to point to? Getting the port wrong when moving your config from dev to prod is a common cause of this particular problem.


If your silverlight application is hosted on another server than the service server it will try to read the file http://serviceserver/clientaccesspolicy.xml to check for access before calling the service.

You must configure your production server to expose this file : you can found information on how to fill this file on http://msdn.microsoft.com/en-us/library/cc645032%28VS.95%29.aspx (example section)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号