2008-12-14 54 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