确定是否ASP.Net已正确注册 [英] Determining if ASP.Net is properly registered

查看:200
本文介绍了确定是否ASP.Net已正确注册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有防弹方法(在C#中最好!)确定ASP.Net正确您的计算机上注册的?

Does anyone have a bulletproof method (in C# ideally!) of determining if ASP.Net is properly registered on your computer ?

我写的ASP.Net应用程序的安装程序,我需要知道我是否应该运行为aspnet_regiis

I am writing an installation program for an ASP.Net application and I need to know whether I should run aspnet_regiis.

目前,我们始终运行为aspnet_regiis 的时刻 - 我保证ASP.Net正确注册,但这不可取的,因为它会提示所有的应用程序池重新启动。

At the moment we always run aspnet_regiis - I to ensure that ASP.Net is registered properly but this undesirable because it prompts a restart of all the application pools.

有在网络上几个有用的页面(如 HTTP:// WWW 。codeproject.com / KB / CS / iisdetection.aspx ),但作为该展后的意见,这是很常见的情况是,注册表报告说,ASP.Net已注册,但为aspnet_regiis 仍需要运行配置IIS。用户'JonB贴东西,看起来像它应该工作IIS6(和IIS7与IIS6兼容性能),但我仍然需要编写单独的检测code为IIS 7禁用IIS6兼容性模式。

There are several useful pages on the web (e.g. http://www.codeproject.com/KB/cs/iisdetection.aspx) but as the comments in that post show, it is quite often the case that the registry reports that ASP.Net is registered but aspnet_regiis still needs to be run to configure IIS. The user 'JonB' posted something that looks like it should work for IIS6 (and IIS7 with IIS6 compatibility enabled) but I would still need to write separate detection code for IIS 7 with IIS6 compatibility mode disabled.

所以,有没有人已经破解这个螺母?如果是的话,请让我们知道,这将是一个节省时间。否则,我会尝试和端口C ++的解决方案到C#的IIS6和IIS7我会看检查< isapiCgiRestriction> 部分 applicationHosts.config

So has anyone cracked this nut already? If so please let us know as it will be a time saver. Otherwise I will try and port the C++ solution into C# for IIS6 and for IIS7 I will look examine the <isapiCgiRestriction> section of applicationHosts.config for

<add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />

最后一个问题...

Last question...

有谁知道,如果事情是相同/不同在Windows 7?

Does anyone know if things are the same/different in Windows 7?

推荐答案

首先我会尝试运行为aspnet_regiis -lv 。这应该给你喜欢的输出:

First I would try running aspnet_regiis -lv. This should give you an output like:

1.1.4322.0      Valid           C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll
2.0.50727.0     Valid           c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll

,你可以轻松地分析,以验证您的目标版本的安装和有效。如果不是,你就必须去为aspnet_regiis -i 路线。

此外,因为你可以做此项检查在C#中,你可以测试页添加到您的ASP.NET应用程序。你通常会考虑安装成功后,做了的HttpWebRequest 的测试页上。页面本身可以作为一个空白页一样简单和复杂,因为在运行安装(文件/文件夹的权限,数据库配置等)的自我检查,如果一切正常,只会返回一个HTTP 200。任何超时或错误表示不好安装。然后,可选,删除测试页。

Also, given that you can do this check in C#, you could add a test page to your ASP.NET application. After what you would normally consider a successful installation, do a HttpWebRequest on that test page. The page itself can be as simple as an empty page and as complicated as running a self-check of the installation (file/folder permissions, DB configuration, etc.) and would only return a HTTP 200 if everything is ok. Any timeout or error indicates a bad install. Then,optionally, delete the test page.

这篇关于确定是否ASP.Net已正确注册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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