开发者

Connecting to a deployed WCF on IIS with Silverlight

开发者 https://www.devze.com 2023-03-24 00:47 出处:网络
I\'ve deployed a WCF service on IIS 7. Browsing to the service from a browser shows that it\'s running fine.

I've deployed a WCF service on IIS 7. Browsing to the service from a browser shows that it's running fine. Connecting to the service from a Silverlight application produces the following error:

The HTML document does not contain Web service discovery information. Metadata contains a reference that cannot be resolved: 'http://localhost:81/SdkService.svc'. 开发者_如何转开发 Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:81/SdkService.svc. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.. If the service is defined in the current solution, try building the solution and adding the service reference again.

The service project is complied with .Net 4.0 and the Application pool for that service is also .Net 4.0

The Silverlight client is also compiled with .Net 4.0

Here's the service web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>
  <system.serviceModel>
    <diagnostics>
      <messageLogging logMalformedMessages="true" logMessagesAtTransportLevel="true" />
    </diagnostics>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true" />
          <dataContractSerializer maxItemsInObjectGraph="6553600"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

</configuration>
enter code here


Silverlight only supports basicHttpBinding. I believe the WCF default is wsHttpBinding so you may need to change this and then update your service reference.

0

精彩评论

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