Https模式访问wcf方法配置

<?xml version="1.0" encoding="utf-8"?>
<configuration>

    <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
    </system.web>
    <system.serviceModel>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
          multipleSiteBindingsEnabled="true" />
        <bindings>
<!--配置此项 -->
            <webHttpBinding>
                <binding name="bindHttps">
                    <security mode="Transport">
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
            </webHttpBinding>
        </bindings>
        <services>
            <service name="WcfService1.Service1">
                <endpoint binding="webHttpBinding" behaviorConfiguration="WebBehavior"
                  contract="WcfService1.IService1" />
<!--在此引用 -->
                <endpoint binding="webHttpBinding" bindingConfiguration="bindHttps" behaviorConfiguration="WebBehavior"
                  contract="WcfService1.IService1" />
            </service>
        </services>
        <behaviors>
            <endpointBehaviors>
                <behavior name="WebBehavior">
                    <webHttp/>
                </behavior>
            </endpointBehaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
                    <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
        <!--
        若要在调试过程中浏览 Web 应用程序根目录,请将下面的值设置为 True。
        在部署之前将该值设置为 False 可避免泄露 Web 应用程序文件夹信息。
      -->
        <directoryBrowse enabled="true"/>
    </system.webServer>

</configuration>


posted on 2025-09-23 16:01  fendoudexiaoniao  阅读(11)  评论(0)    收藏  举报

导航