WCF Configuration Issues on Shared Hosting

醉酒当歌 提交于 2019-12-08 06:07:07

问题


I have a WCF Service that works fine locally, on a server and on Azure. However i am trying to deploy the same code to RackSpace Sites (Shared Hosting Environment is running .NET 4.0. IIS7 & Windows Server 2008) and am running in the following error when the service returns a response:

Message:[System.ServiceModel.ProtocolException] = {"The content type text/html of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the res...

InnerException:_innerException = {"The remote server returned an error: (500) Internal Server Error."}

The thing is, although the response is an error, the method does successfully receive the data and pass it into the data base, So the issue seems to be in the response back from the WCF Method to the client application. Has anyone run into this before? I know that the trust levels on shared hosting might be to blame - but nothing I have tried has seemed to alleviate the errors I'm getting.

Here is my configuration on the web application consuming the WCF Service:

The Binding:

<binding name="BasicHttpBinding_IAccountService" closeTimeout="00:10:00"
      openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />

      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>

    </binding>

And the endpoint:

<client>
  <endpoint address="http://sitename.com/Services/AccountService.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAccountService"
    contract="AccountService.IAccountService" name="BasicHttpBinding_IAccountService" /></client>

This is the default binding/endpoint generated when using "Add Service Reference"

The app hosting the WCF Service does not use any custom configurations, but here is the behaviours portion of it's Web.Config:

<behaviors>
  <serviceBehaviors>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"  />

来源:https://stackoverflow.com/questions/5183810/wcf-configuration-issues-on-shared-hosting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!