简体   繁体   English

通过传输安全性使用Https basicHttpBinding获取404无端点侦听错误WCF 4.0

[英]Getting 404 no endpoint listening error WCF 4.0 using Https basicHttpBinding over Transport security

I am trying to get https security working for my wcf web service hosted in IIS 7.5. 我正在尝试使IIS 7.5中托管的wcf Web服务的https安全性起作用。 I have looked through every article I can find online regarding this and tried just about every configuration or IIS trick I could find or variation. 我浏览了所有可以在网上找到的与此相关的文章,并尝试了可以​​找到或更改的每种配置或IIS技巧。 I think this might be a IIS, windows level configuration issue. 我认为这可能是IIS,Windows级别的配置问题。 We are using a wild card SSL cert like *.mycompany.com. 我们正在使用通配符SSL证书,例如* .mycompany.com。 This cert is being used on 3 other sites already in same IIS if that has any bearing. 如果具有相同的作用,则该证书正在同一IIS中已经存在的其他3个站点上使用。 Does anyone have any idea what I am running into here??? 有人知道我在这里遇到什么吗??? This is a public server, non TEST and http binding works fine. 这是一个公共服务器,非TEST和http绑定可以正常工作。 I am having this same https issue on my dev and production servers. 我的开发服务器和生产服务器上都遇到同样的https问题。 We have another https website on this production box and it sends and receives data just fine. 我们在此生产包装盒上还有另一个https网站,它可以发送和接收数据。 I am getting Exception : 我收到异常:

There was no endpoint listening at https://subdomain.mydomain.com/MyService.svc that could accept the message. https://subdomain.mydomain.com/MyService.svc上没有侦听终结点的端点可以接受该消息。 This is often caused by an incorrect address or SOAP action. 这通常是由不正确的地址或SOAP操作引起的。

Inner Exception : 内部异常:

The remote server returned an error: (404) Not Found. 远程服务器返回错误:(404)找不到。

Here is my web.config : 这是我的web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <appSettings file="LocalAppSettings.config">
      <!--<add key="CustomIISServiceHostEndPoint" value="https://subdomain.mydomain.com/MyService.svc" />-->
   </appSettings>
   <system.web>
      <compilation debug="true" targetFramework="4.0" />
      <customErrors mode="Off" />
  </system.web>
  <system.serviceModel>
      <bindings>
  <basicHttpBinding>
    <binding name="COLWebServiceBinding" maxReceivedMessageSize="134217727" sendTimeout="00:03:00" receiveTimeout="00:03:00">
        <security mode="Transport">
           <transport clientCredentialType="None" />
        </security>
        <readerQuotas maxArrayLength="65536" maxBytesPerRead="65536" maxStringContentLength="134217727" />
     </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="COLWebService.ServiceBehavior" name="COLWebService">
    <endpoint address="https://subdomain.mydomain.com/MyService.svc"
              binding="basicHttpBinding"
              contract="MyCompany.COLWebService.ICOLWebService"
              bindingConfiguration="COLWebServiceBinding" />
    <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
  </service>
</services>
<extensions>
  <behaviorExtensions>
    <add name="errorHandler" type="MyCompany.COLWebService.ErrorHandlerBehaviorExtensionElement, MyCompany.COLWebService" />
  </behaviorExtensions>
</extensions>
<behaviors>
  <serviceBehaviors>
    <behavior name="COLWebService.ServiceBehavior">
      <serviceMetadata httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <!--<behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>-->
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false">
</serviceHostingEnvironment>
 </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer> 
 </configuration>

And here is my client's app.config : 这是我客户的app.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                 <binding name="wsHttpBinding_ICOLWebService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:03:00"
                allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="134217727"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
                      <readerQuotas maxStringContentLength="134217727" maxArrayLength="65536"
                    maxBytesPerRead="65536" />
                      <security mode="Transport">
                          <transport clientCredentialType="None" proxyCredentialType="None" />
                     </security>
                 </binding>
            </basicHttpBinding>
         </bindings>
        <client>
             <endpoint address="https://subdomain.mydomain.com/MyService.svc"
            binding="basicHttpBinding" bindingConfiguration="wsHttpBinding_ICOLWebService"
            contract="COLWebService.ICOLWebService" name="wsHttpBinding_ICOLWebServiceEP" />
          </client>
    </system.serviceModel>
  </configuration>

You can manually add host header values to SSL certificates by modifying the applicationhost.config file in system32\\inetsrv. 您可以通过修改system32 \\ inetsrv中的applicationhost.config文件来手动将主机头值添加到SSL证书。 Look for the section for your IIS instance. 查找您的IIS实例的部分。

It could be that the https binding has not been configured for the new site. 可能是尚未为新站点配置https绑定。

In IIS, select the site, then click on advanced settings and check the contents of Bindings. 在IIS中,选择站点,然后单击高级设置并检查绑定的内容。 Make sure that https is in the list. 确保https在列表中。

Edit 编辑

The other thing that it could be is that the svc handler is not activated. 另一件事可能是未激活svc处理程序。 Is ASP.Net turned on for the site? 网站是否已打开ASP.Net?

You should test it without the https first, to make sure that the problem is related to https. 您应该首先在不使用https的情况下对其进行测试,以确保问题与https有关。

Edit 2 编辑2

Make sure that the site is started. 确保该站点已启动。 Have you checked that you can access the svc via a browser. 您是否检查过可以通过浏览器访问svc。

You have several sites on the machine, all use https. 您在计算机上有几个站点,都使用https。 Have you configured host headers to allow all sites to use https? 您是否已配置主机头以允许所有站点使用https? Is https on this site on a different port? 这个站点上的https是否在其他端口上?

Open the .svc file - I would guess its not referencing COLWebService as the service. 打开.svc文件-我猜它没有将COLWebService引用为服务。

Your config file has: 您的配置文件具有:

name="COLWebService"

in the service declaration. 在服务声明中。 This needs to match .SVC's named service, which looking at the url you've given, I think will be 'MyService'. 这需要匹配.SVC的命名服务,该服务会查看您提供的url,我认为这将是“ MyService”。

Your service model section should be like this 您的服务模型部分应如下所示

<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" httpsGetUrl="/ssl"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <dataContractSerializer maxItemsInObjectGraph="6553600" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <basicHttpBinding>
        <binding name="TransportSecurity" maxReceivedMessageSize="2147483647">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="COLWebService.Service" behaviorConfiguration="">
        <endpoint address="/ssl" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" contract="MyCompany.COLWebService.ICOLWebService"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

And your clients will access servis over https https://subdomain.mydomain.com/MyService.svc/ssl , over http same as old https://subdomain.mydomain.com/MyService.svc 您的客户将通过与旧的https://subdomain.mydomain.com/MyService.svc相同的http通过https https://subdomain.mydomain.com/MyService.svc/ssl访问servis

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

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