我有一個WCF服務託管在IIS 5.1上禁用了匿名訪問。下面是web.config文件中顯示的服務是如何配置的一部分:未能調用WCF服務
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingCfg">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ServiceBehavior" name="HelloService">
<endpoint name="BasicHttpEndpoint"
address=""
binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingCfg"
contract="IHelloService">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
我每次調用任何操作,該服務從桌面應用程序公開,我收到以下錯誤信息:
未提供所需的模擬級別,或者提供的模擬級別無效。
請注意,綁定類型和託管環境是由客戶端預先確定的,不能更改。
任何可能導致解決此問題的幫助將不勝感激。
謝謝!
禪
編輯:下面是客戶端的配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpoint" 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="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint name="BasicHttpEndpoint"
address="http://vm00000033871b.intra.pri/WCFServiceBasicHttp/HelloService.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpEndpoint"
contract="Proxy.IHelloService" />
</client>
</system.serviceModel>
你是如何調用服務,您是否傳遞Windows身份驗證的網絡憑據? – TheCodeKing
@TheCodeKing,這裏是我如何調用服務:'使用代理作爲新的PRX.HelloServiceClient()昏暗的消息作爲字符串= proxy.Hello(「你好」)MessageBox.Show(消息)結束使用'。由於客戶端的屬性ClientCredentials是ReadOnly屬性,因此我沒有傳遞任何網絡憑據。 – UncleZen