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

前端 未结 2 1654
北海茫月
北海茫月 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
    
    0 讨论(0)
  • 2021-01-19 22:20

    This usually happen when the WCF service is deployed in a different domain in respect to the application location. If this is a temporary situation having tboth service and application on the same domain will solve. If it is not possible create a proxy for the remote service on the application could work.

    0 讨论(0)
提交回复
热议问题