WCF:从开发到生产网站

时间:2014-10-30 20:34:16

标签: asp.net wcf

我的开发服务器(test2.com)上有一个ASP.NET网站,其中包含两个WCF服务,这些服务在自己的IIS应用程序中设置在该网站的子目录中(test2.com/services) 。一切都在这个网站上工作。我现在已准备好将此网站和服务移至我的生产服务器(test.com和test.com/services),无论我尝试什么,我都会不断收到HTTP 400消息。我已经更新了生产网站上的服务引用,并重命名了服务上的相应引用以指向生产URL。我还在我的客户端web.config文件中对以下内容进行了适当的更新:

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IChatService" />
    <binding name="BasicHttpBinding_IOnlineUsersService" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="http://test.com/services/ChatService.svc/services/chatservice.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IChatService"
    contract="Chat.IChatService" name="BasicHttpBinding_IChatService" />
  <endpoint address="http://test.com/services/OnlineUsersService.svc/services/onlineusersservice.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IOnlineUsersService"
    contract="OnlineUsers.IOnlineUsersService" name="BasicHttpBinding_IOnlineUsersService" />
</client>
</system.serviceModel>

服务上相应的web.config文件包含以下内容:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
  <service name="ChatServiceLibrary.ChatService">
    <endpoint address="/services/chatservice.svc" binding="basicHttpBinding" contract="ChatServiceLibrary.IChatService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service name="ChatServiceLibrary.OnlineUsersService">
    <endpoint address="/services/onlineusersservice.svc" binding="basicHttpBinding" contract="ChatServiceLibrary.IOnlineUsersService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="metadataBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
</system.serviceModel>

如果我从Web浏览器调用它们,Web服务本身就可以正常工作。我错过了什么?

0 个答案:

没有答案