WCF和SSL的问题

时间:2011-09-12 23:29:43

标签: wcf

我在使用SSL和WCF工作时遇到问题。

如果我在IIS中检查“需要SSL”,那么我会收到此错误:

  

WebHost无法处理请求。

     

发件人信息:   System.ServiceModel.ServiceHostingEnvironment + HostingManager / 36097441   异常:System.ServiceModel.ServiceActivationException:服务   由于编译期间的异常,无法激活“/”。该   异常消息是:服务   'ISS.MS.WebServices.MessageDispatch.MessageDispatchWebService'有   零应用(非基础设施)端点。这可能是因为   找不到您的应用程序的配置文件,或者没有找到   匹配服务名称的服务元素可以在   配置文件,或者因为没有定义端点   服务要素.. ---> System.InvalidOperationException:服务   'ISS.MS.WebServices.MessageDispatch.MessageDispatchWebService'有   零应用(非基础设施)端点。这可能是因为   找不到您的应用程序的配置文件,或者没有找到   匹配服务名称的服务元素可以在   配置文件,或者因为没有定义端点   服务要素。

但是,如果我取消选中它,页面会在浏览器中正常加载但是我收到此错误 我试着打电话的时候。

  

服务'ISS.MS.WebServices.MessageDispatch.MessageDispatchWebService'   没有应用程序(非基础结构)端点。这可能是   因为没有找到您的应用程序的配置文件,或   因为没有找到与服务名称匹配的服务元素   配置文件,或者因为没有定义端点   服务要素。

这是配置:

<system.serviceModel>
    <services>
        <service name="ISS.MS.WebServices.MessageDispatchWcfService">
            <endpoint
                address="" 
                binding="basicHttpBinding" bindingConfiguration="basicHttpBinding_MS2" 
                contract="ISS.MS.WebServices.IMessageDispatchWcfService" />
            <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior>
                <serviceDebug includeExceptionDetailInFaults="False" />
                <serviceMetadata httpsGetEnabled="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>

    <bindings>
        <basicHttpBinding>
            <binding name="basicHttpBinding_MS2" >
                <readerQuotas maxStringContentLength="1048576" />
               <security mode="Transport">
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
    </serviceHostingEnvironment>
</system.serviceModel>

我可以使用普通的HTTP完美地工作,但HTTP不起作用。

我猜它是IIS设置还是WCF配置问题?

2 个答案:

答案 0 :(得分:3)

我明白了,服务和合同的名称不正确......多么令人尴尬。

任何人都知道为什么它仍可以通过HTTP工作,即使它们不正确?

答案 1 :(得分:0)

(关于&#34; multipleSiteBindingsEnabled&#34;):要为服务的每个站点启用多个IIS绑定,请将此属性设置为true。请注意,仅HTTP协议支持多个站点绑定。

参考:http://msdn.microsoft.com/en-us/library/system.servicemodel.configuration.servicehostingenvironmentsection.multiplesitebindingsenabled.aspx

试试这个

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false">
</serviceHostingEnvironment>