简体   繁体   English

WCF Web服务+身份验证

[英]WCF Web Service + Authentication

I've followed the steps on this page: 我已按照此页面上的步骤操作:

http://www.codeproject.com/Articles/295831/WCF-NET-4-0-Console-Hosted-Json-Rest-Secure-Http-W http://www.codeproject.com/Articles/295831/WCF-NET-4-0-Console-Hosted-Json-Rest-Secure-Http-W

To create a JSON web service using HTTPS and WCF 4.0. 使用HTTPS和WCF 4.0创建JSON Web服务。 This all works perfectly in the console application. 所有这些都可以在控制台应用程序中完美运行。

I was trying to test some Jquery queries to the web service but was getting pretty irritated with all the restrictions with regards to cross-domain requests. 我试图测试一些对Web服务的Jquery查询,但是由于对跨域请求的所有限制而感到非常恼火。

I therefore moved my web service to IIS and now it doesn't pick up my authentication. 因此,我将Web服务移到了IIS,现在它不接受身份验证。 It won't authenticate with my custom auth provider. 它不会使用我的自定义身份验证提供程序进行身份验证。 I found that I could type in my windows username and password, but then obviously the Identity is incorrect as it has the wrong username. 我发现可以输入Windows用户名和密码,但是很明显,身份标识不正确,因为用户名错误。

My security mode is Transport and clientCredentialType is Basic as per the link above. 根据上面的链接,我的安全模式是Transport,clientCredentialType是Basic。

After some searching I found this: 经过一番搜索,我发现了这一点:

http://custombasicauth.codeplex.com/ http://custombasicauth.codeplex.com/

Which looked promising, but after installing it I don't see the authentication provder in IIS at all. 看起来很有希望,但是安装后,我完全看不到IIS中的身份验证提供者。 I'm using a 64-bit windows 7 system with .NET 4.0 我正在使用带有.NET 4.0的64位Windows 7系统

Does anyone know how to get this working or if I should take a different approach? 有谁知道如何使它起作用,或者我是否应该采用其他方法?

All I'm wanting to end up with is a JSON web service where I authenticate once (don't have to send username / password with every JSON request) and can then send JSON requests to the web service while it still remembers which user is logged in. 我最后想要做的是一个JSON Web服务,在此我进行一次身份验证(不必在每个JSON请求中发送用户名/密码),然后可以向该Web服务发送JSON请求,同时它仍记住哪个用户是登录。

Here is the MSDN document explaining how to use the WCF Authentication Service: http://msdn.microsoft.com/en-us/library/bb386582.aspx . 这是解释如何使用WCF身份验证服务的MSDN文档: http : //msdn.microsoft.com/zh-cn/library/bb386582.aspx The documentation includes a walkthrough; 该文档包括一个演练; it is lengthy, but I think it will help you get on the right track. 它很长,但是我认为它将帮助您走上正确的道路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM