身份验证模式= QUOT;表单"在WCF终点导致错误 [英] Authentication mode="Forms" causing errors in WCF end point
问题描述
我有我的.NET 4.0的Web应用程序项目中一个WCF终点。使用VS2010 WCF测试客户端,我可以正确连接到服务。然而,当我去帮衬我得到一个一般性错误消息:
I have a WCF end point inside my .NET 4.0 Web Application project. Using the VS2010 WCF Test Client, I can connect to the service correctly. However when I go to use the service I get a generic error message:
内容类型text / html;字符集= UTF-8的响应消息不匹配绑定的内容类型(文本/ XML的,字符集= UTF-8)。如果使用自定义的连接codeR,确保IsContentTypeSupported方法正确实施。第一个1024字节的响应是:
The content type text/html; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were:
我发现,当我删除的web.config文件验证的服务正常工作:
I have discovered that when I remove the authentication from the web.config file the service works correctly:
<authentication mode="Forms">
<forms cookieless="AutoDetect" loginUrl="~/Security/LoginClient.aspx" name="FORMAUTH" />
</authentication>
任何想法如何,我可以从认证只删除此服务?
Any ideas how I can remove just this service from the authentication?
推荐答案
您可以排除窗体身份验证的具体文件,在web.config中的位置的节点:
You can exclude specific files from forms authentication with a location node in web.config:
<location path="MyService.svc">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
这是更简单的方法也只是以小组服务相关的文件不需要身份验证到一个公用文件夹并允许访问整个文件夹:
An easier way would just be to group the service related files don't require authentication into a public folder and allow access to the entire folder:
<location path="MyServiceFolder/">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
MSDN上的位置元素的更多信息:
More information on the location element on MSDN:
http://msdn.microsoft.com/ EN-US /库/ b6x6shw7%28vs.71%29.aspx
这篇关于身份验证模式= QUOT;表单&QUOT;在WCF终点导致错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!