使用 Visual Studio Web 服务器运行时的身份验证对话框

发布于 2024-07-13 02:55:20 字数 202 浏览 5 评论 0原文

使用 Visual Studio 的内置 Web 服务器时,每次我发出页面请求时,都会弹出标准登录框并要求提供凭据。 如果我真的输入了我的凭据,它就不起作用,所以我只需按取消键 5 次,它就会消失。

当我通过 IIS(本地或测试服务器上)运行应用程序时,它工作得很好(没有出现登录框)。

任何人都知道如何解决这个问题或者知道可能是什么原因造成的?

When using Visual Studio's built in web server, every time I make a page request the standard login box pops up and asks for credentials. It doesn't work if I actually put in my credentials, so I just have to hit cancel 5 times so it will go away.

When I run the application through IIS (locally or on test server) it works just fine (no login box comes up).

Anyone know how to fix this or have any idea what might be causing it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

枕头说它不想醒 2024-07-20 02:55:20

我假设您指的是类似 JavaScript 警报框的登录对话框,对吧? 当您向 IIS 禁用匿名访问的网站部分发出请求时,会弹出此对话框。 它与 ASP.NET 身份验证不同。

您的网站的某些部分是否受到保护? 或者您是否向外部站点(例如图像等)发出任何 HTTP 请求?

如果您的页面在多次点击取消后看起来没问题,那么它一定是对受保护文件(如图像、CSS、JS 或其他文件)的 HTTP 请求之一。

我会在 Fiddler 或 Firebug 中查看当您在登录对话框中点击“取消”时是否有任何请求失败。

我还会尝试清除在 IIS 上运行的页面上的缓存/经过身份验证的会话,以查看它是否确实向您显示该登录对话框。

I assume you mean JavaScript alert box-looking login dialog, right? This dialog pops up when you make a request to a portion of website where anonymous access is disabled from IIS. It is different from ASP.NET authentication.

Do you have some portion of web site protected? Or are you making any HTTP request to external sites, like images and etc?

If your page looks ok after hitting cancel multiple times, it must be one of those HTTP request to protected file like images, css, js or whatever.

I'd look in Fiddler or Firebug to see if any request is failed when you hit cancel in that login dialog.

I'd also try clearing cache/authenticated session on the page that runs on IIS to see if it actually shows you that login dialog.

你另情深 2024-07-20 02:55:20

我也有同样的问题。 然而,我的解决方案不同,问题似乎也不同。

我一直在使用 VS 2008 开发 ASP.NET 2.0 Web 应用程序。内置 IIS 服务器一切正常。 我大约一周没有打开这个项目,然后当我在 VS 中选择“在浏览器中查看”时,系统会提示我输入 Windows 登录凭据。 这个项目以前从未这样做过,所以我有点困惑。 我检查了所有 web.config 设置,一切似乎都很好。 我的项目设置似乎也正确。 我决定通过使用网络路径在网络上的单独开发盒上的 VS 中打开同一个项目来测试该项目。 我再次选择“在浏览器中查看”,效果很好。 没有登录提示。

这告诉我问题不在于实际的网络项目本身,而在于我的开发环境。 我按照上面的建议检查了所有浏览器设置,它们是正确的。 然后,当我在两个开发框中打开相同的项目(相同的物理文件)时,我比较了我的项目设置。 我注意到了一个区别...

在属性页的启动选项下,Web 服务器在这两种情况下都设置为使用默认 Web 服务器。 但是,在要求我提供凭据的框中,选中了“NTLM 身份验证”复选框。 我取消选择此选项并解决了问题。

我不确定这是如何可能的,因为我打开相同的项目文件,并且假设项目设置完全相同。 一周前它运行良好这一事实确实让我感到困惑。 我将其归因于包装盒上的 VS 2008 问题。 我希望这对可能遇到此问题的其他人有所帮助。

I had this same issue. However, my solution was different and the issue seemed different as well.

I had been working on a ASP.NET 2.0 web application, using VS 2008. Everything was working fine with the built-in IIS server. I hadn't opened this project for about a week and then when I chose "View in browser" in VS, I was prompted for my windows login creds. This project never did this before, so I was a bit baffled. I checked all the web.config settings and everything seemed fine. My project settings seemed correct as well. I decided to test the project by opening this same project in VS on a separate dev box on my network using a network path. I again chose "View in browser" and it worked fine. No logon prompt.

This told me that the issue wasn't with the actual web project itself, rather my dev environment. I checked all my browser settings as suggested above, and they were correct. I then compared my project settings while I had the same project (same physical files) opened in both dev boxes. I noticed a difference...

Under the Start Option in the Property Pages, the Web Server was set to use the Default Web server in both cases. However, on the box that was asking for my creds, the NTLM Authentication checkbox was selected. I unselected this and it resolved the issue.

I'm not sure how this was possible since I was opening the same project files, and would assume the project settings would be exactly the same. And the fact it was working fine a week ago really perplexed me. I chalked it up to an issue with VS 2008 on the box with the issue. I hope this helps anyone else that may be running into this issue.

野心澎湃 2024-07-20 02:55:20

这是因为 localhost 不在我的受信任站点中,因此它不会执行自动 NTLM 身份验证...我不确定为什么会这样,但它是...将 localhost 添加到列表中修复了它。

This was because localhost was not in my trusted sites so it wouldn't do automatic NTLM authentication... I'm not sure why it was that way, but it was... adding localhost to the list fixed it.

も让我眼熟你 2024-07-20 02:55:20

在您的项目中,应该有一个 vwd.webinfo 文件。

以下几行控制调试时的身份验证(在 IISExpress 中)。 设置如下以避免所有对话框。

<VisualWebDeveloper>
<iisExpressSettings anonymousAuthentication="enabled" windowsAuthentication="disabled" useClassicPipelineMode="false"/>
</VisualWebDeveloper>

如果windowsAuthentication="enabled",即使anonymousAuthentication="enabled",您仍然可能会收到一个对话框:-)

In your project, there should be a vwd.webinfo file.

The following lines control authentication when debugging (in IISExpress). Set as follows to avoid all dialogs.

<VisualWebDeveloper>
<iisExpressSettings anonymousAuthentication="enabled" windowsAuthentication="disabled" useClassicPipelineMode="false"/>
</VisualWebDeveloper>

If windowsAuthentication="enabled" you may still get a dialog, even if anonymousAuthentication="enabled" :-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文