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

时间:2017-05-26 11:18:34

标签: wcf wcf-endpoint

我的wcf服务正在运行,直到我做了两处更改。当我在调试模式下运行时,我没有错误,但是当我将它部署到生产中时,我得到了#34;无终点"例外。我已经按照其他帖子提供的建议,但没有变化。任何人都可以帮我解决这个问题吗?

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


Function method3(ByVal parameter1 As String, ByVal parameter2 As Byte()) As String


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



<bindings>
  <basicHttpsBinding>
    <binding maxReceivedMessageSize="2100000000"></binding>
  </basicHttpsBinding>
</bindings>
&#13;
&#13;
&#13;

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>

客户端配置

&#13;
&#13;
<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>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

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

{{1}}