在https:// localhost:44302 / Service7.svc上没有可以接受该消息的端点

时间:2015-07-27 19:39:25

标签: c# wcf iis

我在IIS上创建了一个WCF服务,并使用HTTPS发布。当我启动客户端代码时,出现错误:

An unhandled exception of type 'System.ServiceModel.EndpointNotFoundException' occurred in mscorlib.dll

Additional information: There was no endpoint listening at https://localhost:44302/Service7.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

但是,当我在浏览器中启动https://localhost:44302/Service7.svc时,我可以获得“您已创建服务”。如下图所示:

enter image description here

这两个网址完全相同,我很困惑,为什么我收到此错误。

我的客户app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpsBinding_IService7">
                    <security mode="Transport" />
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://localhost:44302/Service7.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpsBinding_IService7" contract="ServiceReference1.IService7"
                name="BasicHttpsBinding_IService7" />
        </client>
    </system.serviceModel>
</configuration>

我的服务web.config

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

0 个答案:

没有答案