Silverlight webservice call works in Studio but fails when run from website

前端 未结 2 1659
北海茫月
北海茫月 2021-01-19 21:58

We are building a Silverlight application and have calls to a Silverlight-WCF service. When running the application from Visual Studio everything works perfectly. When we

2条回答
  •  悲&欢浪女
    2021-01-19 22:08

    There are two things that you need to do.

    First, provide clientaccesspolicy.xml and/or crossdomain.xml files on the website. This MSDN article has details. I also found this blog entry to be useful.

    Second, ensure that your service reference endpoints are pointing to the right URL. For my projects, I have different build configurations (Release, Debug, Test, Beta, etc.) and several endpoints. I then select the appropriate endpoint using #if directives in my code.

    For example:

        soapClient =
    #if DEBUG
            new MySoapClient("DebugService");
    #elif TESTRELEASE
            new MySoapClient("TestService");
    #elif BETA
            new MySoapClient("BetaService");
    #else
            new MySoapClient("ReleaseService");
    #endif
    

提交回复
热议问题