当我对静态文件启用身份验证时,为什么会出现服务器错误?

发布于 2024-10-09 17:57:54 字数 685 浏览 0 评论 0原文

我正在将网站升级到 IIS7、.NET 4.0 和集成管道,但遇到了一些问题。

我的 IIS 安装中有一个子应用程序(远程服务器上的虚拟目录),其中包含静态文件,我希望使用 WindowAuthentication 对其进行身份验证,而我的网站的其余部分将使用 FormsAuthentication。

它有一个 web.config,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
    <authentication mode="Windows" />
    <authorization>
        <allow users="?" />
    </authorization>
</system.web>

我在父 web.config 中添加了 2 个身份验证模块,并删除了默认的 ManagedOnly 前提条件。尽管如此,显然由于删除语句,该目录未经过任何身份验证。但是,如果删除这些行,则会收到通用服务器 500 错误。我还缺少其他东西吗?

I am upgrading my site to IIS7, .NET 4.0 and Integrated Pipeline and am having some issues.

I have a sub application (virtual directory on a remote server) in my IIS install which contains static files, and I want it to be authenticated using WindowAuthentication where as the rest of my site will be using FormsAuthentication.

It has a web.config that looks like:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
    <authentication mode="Windows" />
    <authorization>
        <allow users="?" />
    </authorization>
</system.web>

I add the 2 authentication modules in the parent web.config and remove the default managedOnly precondition. Although, obviously because of the remove statement the directory is not under any authentication. However if I remove those lines, I get a generic server 500 error. Am I missing something else?

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

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

发布评论

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

评论(1

旧人哭 2024-10-16 17:57:54

好的,发生这种情况的原因实际上非常简单,应用程序没有 Bin 目录,因此它没有所需的任何 DLL,因此它抛出错误,因为它不知道如何创建一个新的WindowsAuthenticationModule

Okay, so the reason this was happening was actually pretty simple, the application didn't have a Bin directory and so it didn't have any of the DLLs it needed and so it was throwing an error because it didn't know how to create a new WindowsAuthenticationModule

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