在云服务器上托管后出现WCF错误

本文关键字:WCF 错误 服务器 | 更新日期: 2023-09-27 18:02:25

我已经创建了一个带有服务引用的asp.net web应用程序,托管在云服务器上。当我在Visual studio上运行asp.net应用程序时,它运行时没有任何错误。但是当我把它托管在云服务器上时,我得到了一个错误"没有端点监听URl可以接受该消息"这是wcf web服务

的端点配置。

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="NewBinding0" />
      </basicHttpBinding>
    </bindings>
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint name="NewStandardEndpoint0" defaultOutgoingResponseFormat="Json" />
      </webHttpEndpoint>
    </standardEndpoints>
    <services>
      <service name="WcfService3.Service1">
        <endpoint address="Service1.svc"
          binding="basicHttpBinding" bindingConfiguration="NewBinding0"
          name="sample" contract="WcfService3.IService1" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="NewBehavior0">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="True" />
  </system.serviceModel>

并听到它是为客户端应用程序

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://teamaaa-001-site1.smarterasp.net/Service1.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
    </client>
  </system.serviceModel>

在云服务器上托管后出现WCF错误

检查协议映射部分。这里是https,而不是http。其他都是http

<add binding="basicHttpBinding" scheme="http" />

添加:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_IService1" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://teamaaa-001-site1.smarterasp.net/Service1.svc"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
            contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
    </client>
</system.serviceModel>