2017-01-24 14 views
1

У меня возникла проблема при вызове WCF, размещенного в веб-приложении C#.IIS 8 - EndpointNotFoundException в WCF

Я попытался вызвать веб-сервис, когда сервер размещен на локальном компьютере, и он работал без каких-либо проблем.

Однако я получил ошибку «Там не было конечной точкой прослушивания в https://cloud.my/MyService/GenerateWCF1.svc», когда сервер размещен на IIS 8.

Примечание: я могу просматривать его непосредственно вставив ссылку, когда он размещен на IIS 8.

Client Code Behind

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(); 

Client 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> 

Сервер Web Config

<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

Проблема решена.

решаемые следующие шаги:

  1. Изменение SecurityMode к "TransportCredentialOnly" вместо "Транспорт"
  2. Адрес установлен в HTTP вместо HTTPS
  3. Set или обходного SSL верительных.
  4. Изменение URL от имени к IP-адрес (например .: https://myurltest.com/WCFName.svc к http://192.1.1.1/WCFName.svc)

Edited: Важный шаг 4 Я забыл добавить в последний раз.