0

在堆栈溢出中再次提出这个问题似乎很愚蠢,因为已经有足够多的帖子在这个主题上......但我可以看到每个帖子都有自己的方式来实现这一点......所以我的配置文件在下面指定......我有跟进所有相关帖子并编写了此 Web 配置文件。但经过所有努力,我也收到以下错误:

“找不到与具有绑定 BasicHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]。”

这是我的 Web.config 文件

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

    <system.web>
        <compilation debug="true" targetFramework="4.0" />
      <globalization requestEncoding="utf-8" uiCulture="en" culture="en-US" responseEncoding="utf-8"/>
    </system.web>
    <system.serviceModel>
        <services>
            <service name="WcfService.Service1" behaviorConfiguration="ReqServiceBehaviour">
                <endpoint address ="" binding="webHttpBinding" contract="WcfService.IService1" behaviorConfiguration="web"/>
                <endpoint address="files" behaviorConfiguration="web" binding="webHttpBinding"
                                bindingConfiguration="httpStreamingBinding" name="UploadEndpoint"
                                contract="WcfService.IService1" />
                <endpoint address="" binding="basicHttpBinding" bindingConfiguration="secureHttpBinding" contract="WcfService.IService1"/>

                <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
            </service>
        </services>

        <bindings>
            <webHttpBinding>
                <binding name="httpStreamingBinding" transferMode="Streamed" />
            </webHttpBinding>
            <basicHttpBinding>
                <binding name="secureHttpBinding">
                    <security mode="Transport">
                        <transport clientCredentialType="None"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>

        <behaviors>
            <serviceBehaviors>
                <behavior name="ReqServiceBehaviour">
                    <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
                    <serviceMetadata httpGetEnabled="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="false"/>
                </behavior>
            </serviceBehaviors>
            <endpointBehaviors>
                <behavior name="web">
                    <webHttp/>
                </behavior>

            </endpointBehaviors>

        </behaviors>

        <protocolMapping>

            <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment  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>
4

1 回答 1

0

也许您可以尝试以下

为了使用 https,您需要设置 httpsGetEnabled="true" 而不是 httpGetEnabled="true"

于 2013-10-15T07:56:05.750 回答