[英]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>
問題解決了。
通過以下步驟解決:
編輯:重要步驟 4 我上次忘記添加了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.