IIS 8.5应用程序初始化和Windows身份验证

2024-01-11

我正在尝试使用 IIS 8.5 上的应用程序初始化模块来预热 Intranet 应用程序。设置正确并且预热有效,但是一旦我禁用匿名身份验证,应用程序就不再预加载(内存使用量仅为 20mb,而初始化访问站点时内存使用量约为 200mb)。

由于这些是需要身份验证的 Intranet 应用程序,因此我们传统上始终仅启用 Windows 身份验证并禁用匿名身份验证。

我正在寻找一种方法来保留此设置并进行应用程序初始化工作。 我发现这一页 http://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET-Apps-alive/IIS 正在使用NT 当局\IUSR对于请求。

在我看来,我的选择是:

  1. 启用匿名身份验证。
  2. 更改用于发出请求的帐户。

理想情况下,我想禁用匿名身份验证。有谁知道我怎样才能实现这一目标?


简而言之,我建议允许非 SSL 匿名访问,例如单个 Init.aspx 页面在您的每个应用程序中。为此,我在我的应用程序中添加了这样一个页面,其中包含文档,以帮助后续管理员/开发人员在必须将代码移动到新服务器时弄清楚如何使其工作。

一个特别帮助我弄清楚如何让它工作的参考资料是web.config 的参考<applicationInitialization> tag http://www.iis.net/configreference/system.webserver/applicationinitialization.

这是我添加到我的应用程序中的 Init.aspx 页面,以防您想使用它的衍生版本:

<%@Page ContentType="text/plain" Language="C#" EnableSessionState="False" EnableViewState="false" AutoEventWireup="false" EnableTheming="false" StylesheetTheme="" Theme="" %>
<%--

The built-in application initialization/preload feature can help in situations where the application takes a while to 
start and/or in situations where some components of the site run as services (e.g. performing scheduled tasks).  This 
feature will make sure that the site is quick when the first user visits the site after a restart and/or will ensure that 
scheduled processes are up and running regardless of when people use the site.

Requirements/procedure for application initialization/preload:
(The procedure is slightly different in versions of IIS before 8.5 because there are no UI options.  Must instead alter
applicationHost.config.  See additional reading for more info.)

1.  Set the app pool for the application to "AlwaysRunning" :
    (IIS Manager > Application Pools > YourAppPoolHere > Advanced Settings... > Start Mode)

2.  Enable Preload: (IIS Manager > Sites> YourSiteOrAppHere > Advanced Settings... > Preload Enabled)

3.  Set initialization properties in the web.config.  e.g.:
      <applicationInitialization doAppInitAfterRestart="true">
        <add initializationPage="/PathToYourApp/Init.aspx" hostName="YourWebsiteNameHere.com" />
      </applicationInitialization>
    See this reference for more info (which can be very important):
    http://www.iis.net/configreference/system.webserver/applicationinitialization

4.  Make the Init.aspx page accessible via HTTP with Anonymous access (which may entail one or more of the following).
      - Set NTFS Permissions on the file to include the IUSR (or Everyone) security principal.
      - Adjust the Authentication, Authorization Rules, IP Address Restrictions, SSL Settings, and any other restrictions 
        for *only* the Init.aspx page:
          4.1  IIS Manager > Sites > YourSiteOrAppHere 
          4.2  Switch from 'Features View' to 'Content View' 
          4.3  Find this Init.aspx page in the right pane and highlight it 
          4.4  Switch back from 'Content View' to 'Features View' once the Init.aspx page is selected.
          4.5  You should now see Init.aspx in the tree view in the left pane.  You can now adjust the access restrictions 
               on just this page (e.g. disable SSL, enable anonymous, etc.)
               Some stuff like this might be in your config:
                 <location path="Init.aspx"><system.webServer><security><authorization>
                   <add accessType="Allow" users="?" />
                 </authorization></security></system.webServer></location>

Additional Reading:

  Some decent guides on installing and enabling Application Initialization:
  http://www.iis.net/learn/get-started/whats-new-in-iis-8/iis-80-application-initialization
  http://weblog.west-wind.com/posts/2013/Oct/02/Use-IIS-Application-Initialization-for-keeping-ASPNET-Apps-alive

  The reference for the init parameters:
  http://www.iis.net/configreference/system.webserver/applicationinitialization

-----------------------------------------------------

Note that by the time the code gets to this page, the code in your Global.asax Application_Start and/or any 
Application_Start HTTP Modules will already have fired, so you may not have any extra work to do here.  This page could 
simply be a dummy page.

TO DO: Add any extra initialization tasks outside of the comment section here if you really want to. e.g.:
<%
MyAppNameSpace.UtilityClass.DoExpensiveStartupRoutine();
%>

//.. and last, just write some dummy text if you ever want to see this page in a browser:
--%>
Application Initialized.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

IIS 8.5应用程序初始化和Windows身份验证 的相关文章

  • 是否有 .NET 库或 API 可以与 IIS 配置数据库交互/编辑它?

    或者我是否坚持使用自己的 XML 切割 功能 我想创建一个小型任务托盘应用程序 以便我可以快速将虚拟目录重新指向硬盘上的几个文件夹之一 一点背景 我的开发机器上的代码库有 3 个不同的 svn 分支 Current Production B
  • 如何将文件透明地传输到浏览器?

    受控环境 IE8 IIS 7 ColdFusion 当从 IE 发出指向媒体文件 例如 mp3 mpeg 等 的 GET 请求时 浏览器将启动关联的应用程序 Window Media Player 我猜测 IIS 提供文件的方式允许应用程序
  • 64 位 ASP.NET MVC 应用程序无法运行

    首先 我之前曾设法让我的一个 64 位测试 Web 应用程序在这台机器上运行 当我为这个项目制作原型时 我已经在 32 位环境中工作了几周 意识到我需要将应用程序切换到 64 位 当我这样做 在项目中将目标平台设置为 x64 并重新部署时
  • IIS6 中是否有与 .htaccess 等效的基于文件的文件? (不是配置/插件)

    有很多similar对此有疑问 但它们似乎都涉及配置权限或安装插件 我正在寻找一种 愚蠢 的解决方案 即允许从源代码控制部署代码并自动访问某些被阻止的路径 而无需任何人配置服务器 我只需要目录和文件阻止 htaccess 没有其他功能 需要
  • win10、iis 10无法启动、w3svc服务启动失败

    IIS 已停止 无法启动 当我检查服务时 w3svc的依赖项都在运行 但无法启动w3svc C Users lust4 sc qc W3SVC SC QueryServiceConfig Success SERVICE NAME W3SVC
  • 使用 Powershell 添加 IIS 8.5 自定义日志记录字段

    带有 IIS 8 5 的 Windows Server 2012 R2 允许使用增强型日志记录自定义日志字段 http www iis net learn get started whats new in iis 85 enhanced l
  • IIS 和 ISAPI-WSGI = 非常慢

    我已经使用 IIS 在 IIS 上加载了 2 个 Django 应用程序isapi wsgi http code google com p isapi wsgi 这些都是服务器设置 Windows Server 2003 IIS6 和 SQ
  • Windows 身份验证失败并显示“401 Unauthorized”

    我有一个 MVC 客户端访问受 IDS4 保护的 Web API 它们都在我的本地计算机上运行并由 IIS 托管 使用本地身份进行身份验证时 该应用程序运行良好 但是 当我尝试使用 Windows 身份验证时 开发工具不断收到 401 Un
  • IIS 7.0和win2k8中有多少个不同的地方需要设置日期格式

    我正在尝试使用 win2k8 将旧的经典 asp 应用程序迁移到 IIS 7 0 如果可以的话 我绝对不想更改旧代码 我在日期格式的自定义区域选项中设置了日期格式 在控制面板中的区域和语言选项中将其更改为 dd MMM yy 我仍然收到 C
  • “固定请求数”后应用程序池回收

    IIS的应用程序池设置为 固定请求数 后回收有什么影响 假设这个数字是100 第99个人连接到我的网站 那么第100个人来了 就会触发应用程序池回收 这是否意味着会话 1 99 的所有会话信息都将丢失 进程内会话将在应用程序池工作进程重新启
  • ServerManager 构造函数在测试环境中崩溃

    我正在 MVC 4 中构建一个控制应用程序 遇到了一个非常烦人的问题 当我在本地调试项目时 它工作正常 但是 当我将项目部署到测试服务器 Windows Server 2008 R2 时 出现以下换行符 ServerManager mana
  • 更改 web.config 的 appSettings 中的值时重新启动 IIS 中的网站

    为了安全起见 当我更改 Web config 中 appSettings 的值时 我总是重新启动网站 以便刷新所有更改 但我真的需要重新启动它吗 IIS 如何处理 appSetting 值 是一次性读取这些值 启动应用程序后 还是每次客户端
  • 将 Web 场迁移到 ASP.NET 运行时版本 4,同时保持会话

    我们已将 Web 应用程序从 net 运行时 2 v 3 5 迁移到 net 运行时 4 v 4 5 我有一个部署问题 我们的 sessionstate 服务器是一个 stateserver 并在单独的服务器上运行框架 2 中的 aspne
  • 使用 MSBuild Web 部署到服务器

    我在 VS 2012 项目中设置了发布配置文件 当我在 VS 中右键单击该项目 选择 发布 并单击 发布 按钮时 它会使用 发布配置文件 中提供的设置将项目发布到服务器 当我使用 msbuild 和命令行时 使用以下语法 msbuild e
  • WCF 错误:相对端点地址

    嗯 对 WCF 还很陌生 我想我有点搞砸了 这就是我到目前为止所做的 我在 IIS 中托管了我的 WCF 服务 首先是合同 using System using System Collections Generic using System
  • Facebook - Curl 错误 SSL_CACERT SSL 证书

    我正进入 状态 Curl 错误 SSL CACERT SSL 证书问题 无法获取本地颁发者证书 当要求 Facebook刮我的页面 https developers facebook com tools debug sharing 通过 h
  • 如何跟踪我的 Web 服务抛出的 IIS 500 错误

    我已经部署了新版本的 ASP NET Web 服务 当客户端调用此服务时 IIS 日志文件报告错误代码 500 我自己 测试 可以使用该服务 没有任何错误 我在 ASP NET Web 服务中启用了错误日志记录 但没有记录任何错误 这使我相
  • IIS 是否为每个连接的用户提供一个线程?

    我正在做一些关于开发线程安全应用程序的研究 我知道用户可以在同一应用程序上使用多个线程 如果 CPU 使用多个线程 但我不确定会发生什么 以及当您有 5 个用户使用同一应用程序时 IIS 如何处理用户 IIS 是做什么的 所有用户都在同一个
  • ASP.net MVC 项目无法在 IIS 上编译

    我以前只是将 ASP NET 网站上传到实时服务器 IIS 会自动编译它们 但是 当我对 asp net MVC 项目执行相同操作时 我只是收到错误 并且我需要在上传项目之前发布 构建 项目 注意1 我使用的是VWD 2008 Expres
  • 了解 ASP.NET 应用程序文件夹

    ASP NET 中的应用程序文件夹用于存储对运行网站至关重要的各种元素 我想更深入地了解这些文件夹 特别是文件夹的可访问性 根据有关的文章ASP NET 网站布局 http msdn microsoft com en us library

随机推荐