繁体   English   中英

IIS 8 - WCF 中的 EndpointNotFoundException

[英]IIS 8 - EndpointNotFoundException in WCF

我在调用 C# Web 应用程序中托管的 WCF 时遇到问题。

当服务器托管在本地时,我尝试调用 web 服务,并且它没有任何问题。

但是,当服务器托管在 IIS 8 上时,我收到错误消息“没有端点在https://cloud.my/MyService/GenerateWCF1.svc 上侦听”。

注意:当它托管在 IIS 8 上时,我可以通过直接插入链接来浏览它。

背后的客户代码

ERPGenerateWCF1.GenerateWCF1Client GenerateWCF1 = new ERPGenerateWCF1.GenerateWCF1Client();        GenerateGST03.ClientCredentials.Windows.AllowedImpersonationLevel =                                 System.Security.Principal.TokenImpersonationLevel.Impersonation;
var address = new EndpointAddress("https://cloud.my/MySystem/GenerateWCF1.svc");
GenerateWCF1 = new ERPGenerateWCF1.GenerateWCF1Client("BasicHttpBinding_IGenerateWCF1", address);
ErrorMsg = GenerateWCF1.DoWork();

客户端 Web.Config

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IGenerateWCF1" receiveTimeout="00:45:00"
          sendTimeout="00:45:00" maxReceivedMessageSize="600000000">
          <security mode="Transport">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
        <binding name="BasicHttpBinding_IGenerateWCF2" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:56498/MySystem/GenerateWCF1.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGenerateWCF1"
        contract="ERPGenerateWCF1.IGenerateWCF1" name="BasicHttpBinding_IGenerateWCF1" />
      <endpoint address="http://localhost:55777/MySystem/GenerateWCF2.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IGenerateWCF2"
        contract="GenerateWCF2.IGenerateWCF2" name="BasicHttpBinding_IGenerateWCF2" />
      <endpoint address="mex"
                binding="mexHttpsBinding"
                contract="IMetadataExchange" />
    </client>
  </system.serviceModel>

服务器网络配置

 <system.serviceModel>
  <behaviors>
   <serviceBehaviors>
    <behavior>
     <serviceMetadata httpGetEnabled="true" />
     <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
   </serviceBehaviors>
  </behaviors>
  <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  <bindings>
   <basicHttpBinding>
     <binding name="BasicHttpBinding_IGenerateWCF1" receiveTimeout="00:45:00"
  sendTimeout="00:45:00" maxReceivedMessageSize="600000000">
       <security mode="Transport">
         <transport clientCredentialType="Ntlm" proxyCredentialType="None"
           realm="" />
         <message clientCredentialType="UserName" algorithmSuite="Default" />
       </security>
     </binding>
     <binding name="BasicHttpBinding_IGenerateWCF2" />
   </basicHttpBinding>
  </bindings>
 </system.serviceModel>

问题解决了。

通过以下步骤解决:

  1. 将安全模式更改为“TransportCredentialOnly”而不是“Transport”
  2. 地址设置为 http 而不是 https
  3. 设置或绕过 SSL 凭据。
  4. 将您的 URL 从名称更改为 IP 地址(例如: https://myurltest.com/WCFName.svchttp://192.1.1.1/WCFName.svc

编辑:重要步骤 4 我上次忘记添加了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM