2016-08-24 63 views
0

您好,我嘗試了所有在堆棧溢出中提供的解決方案。我得到「提供的URI方案'https'無效;期望'http'。參數名稱:通過」錯誤。服務在IIS7中運行良好,我在嘗試使用此服務時遇到此錯誤。請參閱我的wcf服務配置和客戶端配置。提供的URI方案'https'無效;預計'http'。參數名稱 - 立即需要幫助

<?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> 

回答

0

我更改了cleint配置綁定部分等於服務配置。我改變了客戶端配置,如下所示。

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

一旦我做到了這一點,我得到了訪問被拒絕的異常。然後我將應用程序池標識從NetworkService更改爲LocalSystem。它像一個魅力,我得到了迴應。我再次嘗試將NetworkService更改爲應用程序池中的Defaultappoolidentity,然後再運行。但是,如果我從客戶端配置中刪除,它會給出錯誤,如「提供的URI方案'https'無效;預期'http'。」讓我知道你們是否對此有任何其他想法。

相關問題