本文介绍了WCF - Windows身份验证 - 安全设置要求匿名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与得到我们的服务器上运行IIS WCF服务苦苦挣扎。部署完成后我结束了一个错误信息:

I am struggling hard with getting WCF service running on IIS on our server. After deployment I end up with an error message:

此服务的安全设置要求匿名身份验证,但没有为承载此服务的IIS应用程序启用。

我想使用Windows身份验证,因此我有匿名访问禁​​用。还要注意的是有aspNetCompatibilityEnabled(如果让任何区别)。

I want to use Windows authentication and thus I have Anonymous access disabled. Also note that there is aspNetCompatibilityEnabled (if that makes any difference).

下面是我的web.config:

Here's my web.config:

<system.serviceModel>
	<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
	<bindings>
		<webHttpBinding>
			<binding name="default">
				<security mode="TransportCredentialOnly">
					<transport clientCredentialType="Windows" proxyCredentialType="Windows"/>
				</security>
			</binding>
		</webHttpBinding>
	</bindings>
	<behaviors>
		<endpointBehaviors>
			<behavior name="AspNetAjaxBehavior">
				<enableWebScript />
				<webHttp />
			</behavior>
		</endpointBehaviors>
		<serviceBehaviors>
			<behavior name="defaultServiceBehavior">
				<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
				<serviceDebug includeExceptionDetailInFaults="true" />
				<serviceAuthorization principalPermissionMode="UseWindowsGroups" />
			</behavior>
		</serviceBehaviors>
	</behaviors>
	<services>
		<service name="xxx.Web.Services.RequestService" behaviorConfiguration="defaultServiceBehavior">
			<endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding"
			 contract="xxx.Web.Services.IRequestService" bindingConfiguration="default">
			</endpoint>
			<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange"></endpoint>
		</service>
	</services>
</system.serviceModel>

我都找遍了,没有运气互联网。任何线索是大大AP preciated。

I have searched all over the internet with no luck. Any clues are greatly appreciated.

推荐答案

所以它看起来像pretty常见的问题。问题的关键是,从您的绑定删除MEX:

So it seems like pretty common issue. The point is to remove mex from your bindings:

<endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange"></endpoint>

Alternativelly您在IIS中启用,并在你的web.config匿名访问您确保匿名访问被拒绝。

Alternativelly you enable Anonymous access in IIS and in your web.config you make sure anonymous access is denied.

希望这将帮助一些其他的灵魂。
(我是100%肯定我MEX删除尝试过:-O)

Hope this will help some other soul.(I was 100% sure I tried it with mex removed. :-O )

这篇关于WCF - Windows身份验证 - 安全设置要求匿名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 07:49