我跑了WCF服务我的第一个Visual Studio 2008的单元测试,我收到以下错误:WCF安全错误使用VS 2008的单元测试
Test method UnitTest.ServiceUnitTest.TestMyService threw exception: System.ServiceModel.Security.MessageSecurityException: The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Negotiate,NTLM'. ---> System.Net.WebException: The remote server returned an error: (401) Unauthorized..
我也收到以下失败审核在安全日志:
Logon Failure: Reason: The user has not been granted the requested logon type at this machine
User Name: (Internet Guest Account)
Domain:
Logon Type: 3
Logon Process: IIS
Authentication Package:
MICROSOFT_AUTHENTICATION_PACKAGE_V1_0
Workstation Name:
我在Windows XP SP3机器上的IIS 6.0托管WCF服务。我为WCF服务虚拟目录选中了“匿名访问”和“集成Windows身份验证”。
下面是我的服务配置文件:
<system.serviceModel>
<services>
<bindings>
<basicHttpBinding>
<binding name="MyBinding">
<security mode="None" />
</binding>
</basicHttpBinding>
<customBinding>
<binding name="MyBinding">
<transactionFlow />
<textMessageEncoding />
<httpsTransport authenticationScheme="Ntlm"/>
</binding>
</customBinding>
<wsHttpBinding>
<binding name="MyBinding">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<service
behaviorConfiguration="Service1Behavior"
name="Service1"
>
<endpoint
address=""
binding="wsHttpBinding"
bindingConfiguration="MyBinding"
contract="IService1"
>
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
没有工作。我收到了同样的错误信息。 – 2008-10-17 22:11:45
已更新至安全模式无 – Karg 2008-10-17 22:24:04
仍然无效....我甚至将bindingName属性添加到服务节点。 – 2008-10-17 22:29:49