部署Web服务时出现问题 [英] Problem in deploying web service

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

问题描述

我正在发送短信的网站上
我正在使用Web服务
当我在Visual Studio中运行程序时,我可以发送短信
我制作了相同的exe,并尝试从IIS托管相同的文件
运行EXE时,程序无法连接到Web服务,并且显示错误
"

I m working on website which sends sms
i m using web service
when i run the program with visual studio i m able to send sms
i made exe of the same and trying to host the same from IIS
while running EXE , the program is unable to connect to web service and it shows the error
"

The request failed with HTTP status 401: Unauthorized.

"

我用日志了解问题出在哪里
直到调用Web服务为止,程序运行正常,并且在该行调用Web服务时,我遇到了以上错误

我已经完成了Web配置的更改,还提供了Web服务的url

"

i used logs to know where the problem is
till call to web service the program works fine and when web service is called at that line i get above error

I have done changes in web config and provided url of webservice also

推荐答案

尝试此

1.您必须添加< identity impersonate ="true">在正在调用Web服务的Web应用程序的Web.Config文件中.
2.尝试使用System.Net.CredentialCache.DefaultNetworkCredentials

如果这不能解决您的问题,请按照以下步骤操作
1.为Web服务从IIS启用匿名访问(请参考 http://support.microsoft.com/kb/324274 [^ ]了解详情)
2.如果您无权更改IIS设置,或者只是因为其他应用程序正在使用它而不想允许匿名,则可以通过指定凭据缓存以编程方式提供权限.这可以通过使用System.Net.CredentialCache.DefaultNetworkCredentials来实现.

希望这会有所帮助.
一切顺利.
Try this

1. You must add <identity impersonate="true"> in Web.Config file of the web application that is calling the web service.
2. Try to use System.Net.CredentialCache.DefaultNetworkCredentials

If this does not solve your issue then follow these steps
1. Enable Anonymous access from IIS for the web service (Refer http://support.microsoft.com/kb/324274[^] for the details)
2. In case you dont have access to change the IIS Settings or you just dont want to allow anonymous because other applications are using it, then you can programatically provide the permissions by specifying the credential cache. This can be achieved by using System.Net.CredentialCache.DefaultNetworkCredentials.

Hope this helps.
All the best.


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

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