一个服务的http和https

时间:2011-02-09 15:25:07

标签: wcf

我正在处理一个问题,但无法解决它。

我有一个服务在asp.net 4.0应用程序内部工作。 该网站可通过http和https获得。 问题是,具有以下提供的配置剪辑的服务可以通过http或通过https工作。

我的配置有什么问题?

<system.serviceModel>
        <bindings>
            <webHttpBinding>
                <binding name="webHttpsBinding">
                    <security mode="Transport">
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
            </webHttpBinding>
        </bindings>
        <behaviors>
            <endpointBehaviors>
                <behavior name="HMS.DataServices.PaymentsServiceBehavior">
                    <enableWebScript />
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>
                <behavior name="HMS.DataServices.PaymentsServiceBehavior">
                    <serviceMetadata httpGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="false" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <services>
            <service name="HMS.DataServices.PaymentsService">

                <!--HTTP-->
                <endpoint address="" binding="webHttpBinding" contract="HMS.DataServices.IPaymentsService" 
                          behaviorConfiguration="HMS.DataServices.PaymentsServiceBehavior" />

                <!--HTTPS-->
                <endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpsBinding" 
                          contract="HMS.DataServices.IPaymentsService"  behaviorConfiguration="HMS.DataServices.PaymentsServiceBehavior" />
            </service>
        </services>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>

此配置适用于https但不适用于nttp

在Windows日志中,我看到下一个错误

 The exception message is: Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].. 

提前致谢!

0 个答案:

没有答案