401访问Web服务时 [英] 401 While Accessing Web Service

查看:75
本文介绍了401访问Web服务时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从网络表单访问ac #web服务。


我按如下方式设置了Web引用代理对象:


proxy.PreAuthenticate = true;

proxy.Credentials = CredentialCache.DefaultCredentials;

但我收到401错误。如果我将IIS网站从集成

Windows Auth切换到匿名,它可以工作......但我希望它使用Windows

安全。

我的网络表单的web.config被设置为防止已登录的

用户,并且我通过检查

来验证这是否正常工作.User.Identity.Name是我的域用户(可以访问网站

服务)。


任何想法我做错了什么? (顺便说一下,如果那个网页服务是SSL,那么

会有所不同)。


谢谢!

I''m trying to access a c# web service from a web form.

I set up the web reference proxy object as follows:

proxy.PreAuthenticate = true;
proxy.Credentials = CredentialCache.DefaultCredentials;
but i get a 401 error. If I switch the IIS website from Integrated
Windows Auth to Anonymous, it works... but i want it to use windows
security.

my web.config of the web form is set to imperonsate the logged on
user, and i verified that''s working by checking that
this.User.Identity.Name is my domain user (which has access to the web
service).

Any ideas what i''m doing wrong? (btw, the web service is SSL if that
makes a difference).

Thanks!

推荐答案

http: //www.dotnetbips.com/articles/d...d151103b2.aspx


查看此内容并查看..


-

LWC Nirosh

" Ben" < be ****** @ gmail.com写信息

新闻:b5 ************************ ********** @ m73g2000 hsh.googlegroups.com ...
http://www.dotnetbips.com/articles/d...d151103b2.aspx

check this and see..

--
L.W.C. Nirosh
"Ben" <be******@gmail.comwrote in message
news:b5**********************************@m73g2000 hsh.googlegroups.com...

我正试图从网上访问ac #web服务表格。


我按如下方式设置了网络参考代理对象:


proxy.PreAuthenticate = true;

proxy.Credentials = CredentialCache.DefaultCredentials;


但我收到401错误。如果我将IIS网站从集成

Windows Auth切换到匿名,它可以工作......但我希望它使用Windows

安全。

我的网络表单的web.config被设置为防止已登录的

用户,并且我通过检查

来验证这是否正常工作.User.Identity.Name是我的域用户(可以访问网站

服务)。


任何想法我做错了什么? (顺便说一下,如果那个网页服务是SSL,那么

会有所不同)。


谢谢!
I''m trying to access a c# web service from a web form.

I set up the web reference proxy object as follows:

proxy.PreAuthenticate = true;
proxy.Credentials = CredentialCache.DefaultCredentials;
but i get a 401 error. If I switch the IIS website from Integrated
Windows Auth to Anonymous, it works... but i want it to use windows
security.

my web.config of the web form is set to imperonsate the logged on
user, and i verified that''s working by checking that
this.User.Identity.Name is my domain user (which has access to the web
service).

Any ideas what i''m doing wrong? (btw, the web service is SSL if that
makes a difference).

Thanks!



4月29日,2:30 * pm,Nirosh < Nir ​​... @ News.Comwrote:
On Apr 29, 2:30*pm, "Nirosh" <Nir...@News.Comwrote:
http://www.dotnetbips.com/articles/d...dfb-190d151103 ...


check这个,看看..


-

LWC Nirosh"本" < benm5 ... @ gmail.com写信息


新闻:b5 *********************** *********** @ m73g2000 hsh.googlegroups.com ...
http://www.dotnetbips.com/articles/d...dfb-190d151103...

check this and see..

--
L.W.C. Nirosh"Ben" <benm5...@gmail.comwrote in message

news:b5**********************************@m73g2000 hsh.googlegroups.com...

我正试图从一个访问ac#web服务网络表格。
I''m trying to access a c# web service from a web form.


我按如下方式设置了Web引用代理对象:
I set up the web reference proxy object as follows:


* * proxy.PreAuthenticate = true;

* * proxy.Credentials = CredentialCache.DefaultCredentials;
* *proxy.PreAuthenticate = true;
* *proxy.Credentials = CredentialCache.DefaultCredentials;


但我收到401错误。 *如果我将IIS网站从集成

Windows Auth切换到匿名,它可以工作......但我希望它使用Windows

安全性。
but i get a 401 error. *If I switch the IIS website from Integrated
Windows Auth to Anonymous, it works... but i want it to use windows
security.


我的网页表单的web.config设置为防止登录的

用户,我验证了'通过检查

this.User.Identity.Name是我的域用户(可以访问网站

服务)来工作。
my web.config of the web form is set to imperonsate the logged on
user, and i verified that''s working by checking that
this.User.Identity.Name is my domain user (which has access to the web
service).


任何想法我做错了什么? (顺便说一句,如果那个网站服务是SSL,那么

会有所不同)。
Any ideas what i''m doing wrong? (btw, the web service is SSL if that
makes a difference).


谢谢! - 隐藏引用的文字 -
Thanks!- Hide quoted text -



- 显示引用的文字 -


- Show quoted text -



谢谢,

无论如何都不使用网络表格认证吗?


疯狂的事情是如果我从Visual Studio中启动我的Web表单它

工作得很好并可以访问Web服务,但是如果我将它发布到

另一台服务器并从那里尝试我得到401(我发布的网站是
发布到使用''集成的windows auth'')。

thanks,
anyway to do it without using web form authentication?

the crazy thing is that if i fire up my web form from Visual Studio it
works just fine and can access the web service, but if i publish it to
another server and try from there I get the 401 (the site i''m
publishing to is using ''intergrated windows auth'') .


好的,检查WSE(Web Service Enhancement)看看如何改进网页

服务安全性..


避免依赖于集成身份验证,创建一个新的网站

为您的网络服务,这样它应该可以正常工作。


-

LWC Nirosh


" Ben" < be ****** @ gmail.comwrote in message

news:69 ************************ ********** @ b64g2000 hsa.googlegroups.com ...

4月29日下午2:30,Nirosh < Nir ​​... @ News.Comwrote:
okay, check WSE (Web Service Enhancement) to see how to improve the web
service security..

to avoid the dependacy with integrated authentication, create a new web site
for your web service, that way it should work fine.

--
L.W.C. Nirosh

"Ben" <be******@gmail.comwrote in message
news:69**********************************@b64g2000 hsa.googlegroups.com...
On Apr 29, 2:30 pm, "Nirosh" <Nir...@News.Comwrote:
http://www.dotnetbips.com/articles/d...dfb-190d151103 ...


check这个,看看..


-

LWC Nirosh"本" < benm5 ... @ gmail.com写信息


新闻:b5 *********************** *********** @ m73g2000 hsh.googlegroups.com ...
http://www.dotnetbips.com/articles/d...dfb-190d151103...

check this and see..

--
L.W.C. Nirosh"Ben" <benm5...@gmail.comwrote in message

news:b5**********************************@m73g2000 hsh.googlegroups.com...

我正试图从一个访问ac#web服务网络表格。
I''m trying to access a c# web service from a web form.


我按如下方式设置了Web引用代理对象:
I set up the web reference proxy object as follows:


proxy.PreAuthenticate = true;

proxy.Credentials = CredentialCache.DefaultCredentials;
proxy.PreAuthenticate = true;
proxy.Credentials = CredentialCache.DefaultCredentials;


但我收到401错误。如果我将IIS网站从集成

Windows Auth切换到匿名,它可以工作......但我希望它使用Windows

安全性。
but i get a 401 error. If I switch the IIS website from Integrated
Windows Auth to Anonymous, it works... but i want it to use windows
security.


我的网页表单的web.config设置为防止登录的

用户,我验证了'通过检查

this.User.Identity.Name是我的域用户(可以访问网站

服务)来工作。
my web.config of the web form is set to imperonsate the logged on
user, and i verified that''s working by checking that
this.User.Identity.Name is my domain user (which has access to the web
service).


任何想法我做错了什么? (顺便说一句,如果那个网站服务是SSL,那么

会有所不同)。
Any ideas what i''m doing wrong? (btw, the web service is SSL if that
makes a difference).


谢谢! - 隐藏引用的文字 -
Thanks!- Hide quoted text -



- 显示引用的文字 -


- Show quoted text -



谢谢,

无论如何都不使用网络表格认证吗?


疯狂的事情是如果我从Visual Studio中启动我的Web表单它

工作得很好并可以访问Web服务,但是如果我将它发布到

另一台服务器并从那里尝试我得到401(网站我是b $ b发布到使用''综合windows auth'')。

thanks,
anyway to do it without using web form authentication?

the crazy thing is that if i fire up my web form from Visual Studio it
works just fine and can access the web service, but if i publish it to
another server and try from there I get the 401 (the site i''m
publishing to is using ''intergrated windows auth'') .


这篇关于401访问Web服务时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆