提供的URI方案' https'是无效的;期待' http'。参数名称 - 需要立即帮助

时间:2016-08-24 20:15:47

标签: c# wcf https wcf-security basichttpbinding

您好我尝试了堆栈溢流中提供的所有解决方案。我得到了#34;提供的URI方案' https'是无效的;期待' http'。参数名称:via"错误。服务在IIS7中正常运行,当我尝试使用此服务时,我收到此错误。请参阅我的wcf服务配置和客户端配置。

  <?xml version="1.0"?>
    <configuration>
    <system.web>
    <compilation targetFramework="4.0"/>
    <httpRuntime/>
    </system.web>
    <system.serviceModel>
    <serviceHostingEnvironment >
    <serviceActivations>
    <add factory="System.ServiceModel.Activation.ServiceHostFactory"         relativeAddress="./CARetriever.svc" service="CARetrieverInterface.CARetriever"/>
      </serviceActivations>
    </serviceHostingEnvironment>

    <behaviors>
      <serviceBehaviors>
        <behavior name="MyTesting">
          <!-- Other options would go here -->
          <useRequestHeadersForMetadataAddress>
            <defaultPorts>
              <add scheme="https" port="443" />
            </defaultPorts>
          </useRequestHeadersForMetadataAddress>
          <serviceMetadata httpsGetEnabled="True"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <services>
      <service name="CARetrieverInterface.CARetriever" behaviorConfiguration="MyTesting">
        <endpoint address="https://sspumptest.dhr.state.ga.us/testcode/CARetriever.svc" binding="basicHttpBinding" contract="CARetrieverInterface.ICARetriever" bindingConfiguration="secureHttpBinding">
          <identity>
            <dns value="sspumptest.dhr.state.ga.us" />
          </identity>
        </endpoint>
        <!--<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />-->
      </service>
    </services>
    <bindings>
      <basicHttpBinding>
        <binding name="secureHttpBinding">
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

My client configuration is given below.

<?xml version="1.0"?>

<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_ICARetriever">             
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://sspumptest.dhr.state.ga.us/testcode/CARetriever.svc"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICARetriever"
          contract="CARetrieverRef.ICARetriever" name="BasicHttpBinding_ICARetriever" />
    </client>
  </system.serviceModel>
</configuration>

1 个答案:

答案 0 :(得分:0)

我将cleint配置绑定部分更改为等于服务配置。我更改了客户端配置,如下所示。

        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_ICARetriever">
                 <security mode="Transport">      
                 </security>                        
                </binding> 
            </basicHttpBinding>
         </bindings>

一旦我这样做,我得到访问被拒绝的例外。然后我将应用程序池标识从NetworkService更改为LocalSystem。它的作用就像一个魅力我得到了回应。我再次尝试将NetworkService更改为应用程序池中的Defaultappoolidentity,然后它也有效。但是,如果我从客户端配置中删除它会给出错误,例如&#34;提供的URI方案&#39; https&#39;是无效的;期待&#39; http&#39;。&#34;。如果您对此有任何其他想法,请告诉我。