C# WCF REST安全模拟
我的网站在IIS7中设置为启用Windows身份验证 我的服务中有3个方法,2个方法需要Windows身份验证,1个不需要。不使用的是C# WCF REST安全模拟,c#,wcf,security,C#,Wcf,Security,我的网站在IIS7中设置为启用Windows身份验证 我的服务中有3个方法,2个方法需要Windows身份验证,1个不需要。不使用的是 [OperationBehavior(Impersonation = ImpersonationOption.Allowed)] 另外两个正在使用 [OperationBehavior(Impersonation = ImpersonationOption.Required)] 我的web.config看起来像: <system.webServer&g
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
另外两个正在使用
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
我的web.config看起来像:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<security>
<authentication>
<anonymousAuthentication enabled="true"/>
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<serviceBehaviors>
<behavior>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceAuthorization impersonateCallerForAllOperations="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" defaultOutgoingResponseFormat="Json" maxBufferPoolSize="2147483647"
maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
当我运行并尝试执行设置为Allowed的方法时,我没有传递任何凭据,它会失败,并出现未经授权的错误。我缺少什么?在使用时,您仍然需要提供凭据
[操作行为(模拟=模拟选项.允许)]
您是否尝试将ImpersonateCallerForAllOperations设置为false