My silverlight application is still trying to connect to localhost after being published to a remote server
I'm developing a silverlight application that uses a web service. It works just fine when I run it on my local machine but when I publish it to a remote server, it fails because it is looking for a a crossdomain.xml policy at localhost:4689 instead of the websites root directory. How do I fix 开发者_运维百科this?
Thanks for the help!
When you add the service reference, the host--in your case, localhost--is included as part of the generated code, and is the default endpoint when you create the service client on the Silverlight end with no constructor parameters.
Use the constructor overload of the service client class that accepts a Uri
parameter to specify the correct hostname (and path to the .svc file) on your production server.
You need to edit your ServiceReferences.ClientConfig because when you deploy your project it's still using the endpoint address of your local computer.
精彩评论