2010-07-08 122 views
0

我有一個WCF Web服務部署在IIS 6上。我現在部署它購買創建一個WebSite並使用默認設置。通過嘗試遠程訪問WCF SecurityNegotiationException

我可以在我的Web瀏覽器中看到DNSService.svc?wsdl,因此我可以訪問此網站。但是,如果我在我的VS項目中創建一個WebReference並嘗試運行WebService的方法,那麼程序將在SecurityNegotiationException中運行。 Messagetext表示類似調用方的東西不能被Web服務認證。但爲什麼我的通道吃了?我dindt設置密碼或ssl或其他東西

我怎麼能改變web服務的行爲,所以我可以跟他說話。

<configSections> 
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
     <section name="DnsClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" /> 
    </sectionGroup> 
    </configSections> 
    <appSettings> 
    <add key="UltraVNC" value="C:\Program Files (x86)\UltraVNC\vncviewer.edxe" /> 
    <add key="CustomerConfigsPath" value="D:\" /> 
    </appSettings> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="WSHttpBinding_IDNSService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" 
      textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <reliableSession ordered="true" inactivityTimeout="00:10:00" 
      enabled="false" /> 
      <security mode="Message"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" 
       realm=""> 
       <extendedProtectionPolicy policyEnforcement="Never" /> 
      </transport> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" 
       algorithmSuite="Default" establishSecurityContext="true" /> 
      </security> 
     </binding> 
    <client> 
     <endpoint address="http://hostnotshownhere/DNSService.svc" 
     binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDNSService1" 
     contract="ServiceReference1.IDNSService" name="WSHttpBinding_IDNSService"> 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
    </client> 
    </system.serviceModel> 
</configuration> 

回答

1

問題是綁定類型! wsHTTPBinding只能在域中使用。對於在互聯網的使用,我不得不建立HTTPBinding像

<bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IDNSService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
      maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="None"> 
      <transport clientCredentialType="None" proxyCredentialType="None" 
       realm=""/> 
      <message clientCredentialType="UserName" algorithmSuite="Default" /> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://MyServer/MyService.svc" 
     binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDNSService" 
     contract="ServiceReference1.IDNSService" name="BasicHttpBinding_IDNSService" /> 
    </client> 
    </system.serviceModel> 

希望這可以幫助別人

+0

在該文件中,可以爲您提供更多的描述,只是相同的XML? – 2013-06-18 10:23:51