2008-12-14 81 views
0

失败,我有一个目录中的Web服务(ASMX文件)规定形式的认证Visual Studio 2005中 - 添加Web引用的安全web服务

当我试图通过VS2005添加Web引用 - 我收到以下错误:

The request failed with the error message: 
-- 
<html><head><title>Object moved</title></head><body> 
<h2>Object moved to <a href="/webchat/login.aspx?ReturnUrl=%2fwebchat%WebService.asmx">here</a>.</h2> 
</body></html> 

当我删除该目录中的web.config(并基本上删除表单身份验证的要求)一切正常。我可以添加WebReference。

有什么想法?

回答

2

放置在你的web.config下面的代码:

<location path="path/to/your/service.asmx"> 
    <system.web> 
     <authorization> 
      <allow users="*"/> 
     </authorization> 
    </system.web> 
</location> 

ASP.Net允许覆盖特定位置的应用程序范围的设置。

+0

感谢它的工作。但是有没有一种方法可以在保持授权要求的同时将它用作web参考? – LeJeune 2008-12-14 22:36:58