簡體   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