从Web应用程序中读取IIS7配置? [英] Read IIS7 configuration from within web application?

查看:217
本文介绍了从Web应用程序中读取IIS7配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是我想做的:

我的web应用程序开始非常慢,直到所有页面都已经预编译并且缓存已填充。我想通过触发一些HTTP请求到最慢页面来预热Global.asax中的应用程序。

My web application is very slow at first until all pages have been precompiled and the cache has been populated. I want to 'warm up' the application in Global.asax by triggering a few HTTP requests to the slowest pages.

问题是我不知道应用程序在哪个端口上运行。可能是80(我的本地IIS或部署的服务器,8080在我们的测试服务器或一些随机端口为一些同事使用ASP.NET开发服务器)

The problem is that I don't know which port the application is running on. Could be 80 (my local IIS or the deployed server, 8080 on our test server or some random port for some colleagues who use the ASP.NET development server)

它将是相当简单的读取合并的Web配置,解压缩绑定,创建一个url并使用HttpWebRequest触发请求。

I thought it would be fairly simple to read the merged web configuration, extract the binding, create a url and trigger the request with HttpWebRequest.

然而,我没有运气...(我主要尝试WebConfigurationManager)

However, I had no luck whatsoever... (I mainly tried WebConfigurationManager)

任何想法? / p>

Any ideas?

推荐答案

我认为你应该能够从Request对象获取这个信息。

I think you should be able to get this info from the Request object.

也就是说,如果没有生产的证据,我会很担心这是一个问题。

That said, I would be leery about worrying about this without some hard evidence from production that it is in fact a problem.

这篇关于从Web应用程序中读取IIS7配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆