System.ServiceModel.EndpointNotFoundException:没有端点侦听配置的 url



我的 wcf 服务一直在工作,直到我进行了两次更改。当我在调试模式下运行它时,我没有收到任何错误,但是当我将其部署到生产环境时,我收到"无终点"异常。我遵循了其他帖子中给出的建议,但没有变化。谁能帮我解决这个问题?

1. 添加了接受字符串和字节数组的方法

函数方法3(ByVal参数1作为字符串,ByVal参数2作为byte(((作为字符串

2. 在 web.config 中添加了一个部分,以便可以发送更大的消息

<bindings>
  <basicHttpsBinding>
    <binding maxReceivedMessageSize="2100000000"></binding>
  </basicHttpsBinding>
</bindings>

WCF 服务配置

  <system.serviceModel>
    <bindings>
      <!--This needs to be changed to http if debugging and https for production-->
      <!--<basicHttpBinding>
        <binding maxReceivedMessageSize="2100000000"></binding>
      </basicHttpBinding>-->
      <basicHttpsBinding>
        <binding maxReceivedMessageSize="2100000000"></binding>
      </basicHttpsBinding>
    </bindings>
    <services>
      <service name="penergydata.penergydata">
        <host>
          <baseAddresses>
            <!--This needs to be changed to http if debugging and https for production-->
            <!--<add baseAddress="http://localhost:49427/"/>-->
            <add baseAddress="https://wcfservices.myefaactweb.com/penergydata/"></add>
          </baseAddresses>
        </host>
        <!--This needs to be changed to http if debugging and https for production-->
        <!--<endpoint address="" binding="basicHttpBinding" contract="penergydata.Ipenergydata"/>-->
        <endpoint address="" binding="basicHttpsBinding" contract="penergydata.Ipenergydata"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <!--This needs to be changed to http if debugging and https for production-->
      <!--<add binding="basicHttpBinding" scheme="http"/>-->
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>

客户端配置

<system.serviceModel>
	<bindings>
		<basicHttpBinding>
			<binding name="BasicHttpsBinding_Ipenergydata">
				<security mode="Transport"/>
			</binding>
		</basicHttpBinding>
	</bindings>
	<client>
		<endpoint address="https://wcfservices.myefaactweb.com/penergydata/penergydata.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpsBinding_Ipenergydata" contract="penergydata.Ipenergydata" name="BasicHttpsBinding_Ipenergydata"/>
	</client>
</system.serviceModel>

请确保在客户端中更改绑定类型。客户端和服务绑定必须匹配。您也可以始终使用 svcutil 来获取服务的正确配置信息。

<system.serviceModel>
    <bindings>
        <basicHttpsBinding>
            <binding name="BasicHttpsBinding_Ipenergydata">
                <security mode="Transport"/>
            </binding>
        </basicHttpsBinding>
    </bindings>
    <client>
        <endpoint address="https://wcfservices.myefaactweb.com/penergydata/penergydata.svc" binding="basicHttpsBinding" bindingConfiguration="BasicHttpsBinding_Ipenergydata" contract="penergydata.Ipenergydata" name="BasicHttpsBinding_Ipenergydata"/>
    </client>
</system.serviceModel>

相关内容

  • 没有找到相关文章

最新更新