如何更改IIS Express 8.0安装目录,以便它不使用“我的文档”?

时间:2021-10-15 21:15:42

Is it possible to change IIS Express 8.0 so that its install and configuration directory is not under "My Documents"?

是否可以更改IIS Express 8.0以使其安装和配置目录不在“我的文档”下?

In our environment, "My Documents" is mapped to a network share.

在我们的环境中,“我的文档”映射到网络共享。

The problem is that this makes local development in Visual Studio .NET 2012 dependent on being on the network.

问题是,这使得Visual Studio .NET 2012中的本地开发依赖于在网络上。

When I run my ASP.NET MVC 4 application in Visual Studio .NET 2012, it spins up IIS Express 8.0.

当我在Visual Studio .NET 2012中运行我的ASP.NET MVC 4应用程序时,它会旋转IIS Express 8.0。

To be quite honest, I'm not sure how IIS Express 8.0 originally got on my development machine. I did not install it directly. However, I have installed both Visual Studio .NET 2012 and Microsoft WebMatrix 2.0 and suspect it came with one (or both) of these.

说实话,我不确定IIS Express 8.0最初是如何在我的开发机器上运行的。我没有直接安装它。但是,我已经安装了Visual Studio .NET 2012和Microsoft WebMatrix 2.0,并怀疑它带有一个(或两个)。

I tried uninstalling IIS Express 8.0 from Programs and Features, going to Microsoft Download Center - IIS 8.0 Express, downloading iisexpress_8_0_RTM_x64_en-US.msi, and reinstalling it.

我尝试从程序和功能卸载IIS Express 8.0,转到Microsoft下载中心 - IIS 8.0 Express,下载iisexpress_8_0_RTM_x64_en-US.msi,然后重新安装。

However, during the install process, I did not see any options for selecting an installation directory.

但是,在安装过程中,我没有看到任何选择安装目录的选项。

If anyone has any experience on changing this, I would be very appreciative of advice or insight. Thank you very much.

如果有人有任何改变这方面的经验,我将非常感谢建议或见解。非常感谢你。

2 个解决方案

#1


1  

Sadly, I think the answer is: this can't be done...yet.

可悲的是,我认为答案是:这还不能做到......

I wanted this myself, so I dug deep into Process Monitor to see if there was some key or file config that could control it. It looks like that key is: HKCU\Software\Microsoft\IISExpress\CustomUserHome (REG_SZ). You can set this to your own custom path on your local drive, and IISExpress will honour it perfectly.

我自己想要这个,所以我深入研究Process Monitor,看看是否有一些可以控制它的密钥或文件配置。它看起来像是:HKCU \ Software \ Microsoft \ IISExpress \ CustomUserHome(REG_SZ)。您可以在本地驱动器上将其设置为您自己的自定义路径,IISExpress将完美地尊重它。

Alas, Visual Studio doesn't use it properly. I think this is a bug. ProcMon shows Visual Studio (briefly) making use of the CustomUserHome entry, but then still going and looking for necessary config files in the %UserProfile%\IISExpress\config\ folder.

唉,Visual Studio没有正确使用它。我认为这是一个错误。 ProcMon显示Visual Studio(简要地)使用CustomUserHome条目,但仍然在%UserProfile%\ IISExpress \ config \文件夹中查找必要的配置文件。

Thus, if you were to try this fix (with the as-of-now current Visual Studio 2012 Update 2 at least), it might sorta look like it's working, but in reality it's still using the same %UserProfile%\IISExpress\config\ folder. If you delete or move that folder, your project won't even open at all.

因此,如果您尝试此修复程序(至少使用现在的Visual Studio 2012 Update 2),它可能看起来像它正在工作,但实际上它仍然使用相同的%UserProfile%\ IISExpress \ config \文件夹。如果删除或移动该文件夹,您的项目甚至根本不会打开。

If there's a way to tell Visual Studio what IISExpress user directory to use, I haven't found it, but would be happy to be enlightened.

如果有办法告诉Visual Studio使用什么IISExpress用户目录,我还没有找到它,但很高兴能够开悟。

This blog post shows a somwhat-similar situation affected by the same bug: http://areaofinterest.wordpress.com/2012/11/13/vs2012-iisexpress-migration-of-domainuser-and-network-share-wtf/

这篇博文显示了同样的错误影响了类似的情况:http://areaofinterest.wordpress.com/2012/11/13/vs2012-iisexpress-migration-of-domainuser-and-network-share-wtf/

#2


0  

The problem is that this makes local development in Visual Studio .NET 2012 dependent on being on the network.

问题是,这使得Visual Studio .NET 2012中的本地开发依赖于在网络上。

You might want to try a different approach to solving this problem.

您可能想尝试不同的方法来解决此问题。

Make the Documents\IIS Express folder on the network share "Always available offline". This uses the Offline Storage feature of Windows to locally cache the network folder and bi-directionally sync changes whenever the network share is available.

使网络共享上的Documents \ IIS Express文件夹“始终可脱机使用”。这使用Windows的脱机存储功能在本地缓存网络文件夹,并在网络共享可用时双向同步更改。

In fact, it's probably better to make the entire Documents folder "Always available offline" to avoid potential problems with other applications that store their user data there and expect that data to always be available.

实际上,最好使整个Documents文件夹“始终可脱机使用”,以避免在其中存储用户数据的其他应用程序的潜在问题,并期望数据始终可用。

#1


1  

Sadly, I think the answer is: this can't be done...yet.

可悲的是,我认为答案是:这还不能做到......

I wanted this myself, so I dug deep into Process Monitor to see if there was some key or file config that could control it. It looks like that key is: HKCU\Software\Microsoft\IISExpress\CustomUserHome (REG_SZ). You can set this to your own custom path on your local drive, and IISExpress will honour it perfectly.

我自己想要这个,所以我深入研究Process Monitor,看看是否有一些可以控制它的密钥或文件配置。它看起来像是:HKCU \ Software \ Microsoft \ IISExpress \ CustomUserHome(REG_SZ)。您可以在本地驱动器上将其设置为您自己的自定义路径,IISExpress将完美地尊重它。

Alas, Visual Studio doesn't use it properly. I think this is a bug. ProcMon shows Visual Studio (briefly) making use of the CustomUserHome entry, but then still going and looking for necessary config files in the %UserProfile%\IISExpress\config\ folder.

唉,Visual Studio没有正确使用它。我认为这是一个错误。 ProcMon显示Visual Studio(简要地)使用CustomUserHome条目,但仍然在%UserProfile%\ IISExpress \ config \文件夹中查找必要的配置文件。

Thus, if you were to try this fix (with the as-of-now current Visual Studio 2012 Update 2 at least), it might sorta look like it's working, but in reality it's still using the same %UserProfile%\IISExpress\config\ folder. If you delete or move that folder, your project won't even open at all.

因此,如果您尝试此修复程序(至少使用现在的Visual Studio 2012 Update 2),它可能看起来像它正在工作,但实际上它仍然使用相同的%UserProfile%\ IISExpress \ config \文件夹。如果删除或移动该文件夹,您的项目甚至根本不会打开。

If there's a way to tell Visual Studio what IISExpress user directory to use, I haven't found it, but would be happy to be enlightened.

如果有办法告诉Visual Studio使用什么IISExpress用户目录,我还没有找到它,但很高兴能够开悟。

This blog post shows a somwhat-similar situation affected by the same bug: http://areaofinterest.wordpress.com/2012/11/13/vs2012-iisexpress-migration-of-domainuser-and-network-share-wtf/

这篇博文显示了同样的错误影响了类似的情况:http://areaofinterest.wordpress.com/2012/11/13/vs2012-iisexpress-migration-of-domainuser-and-network-share-wtf/

#2


0  

The problem is that this makes local development in Visual Studio .NET 2012 dependent on being on the network.

问题是,这使得Visual Studio .NET 2012中的本地开发依赖于在网络上。

You might want to try a different approach to solving this problem.

您可能想尝试不同的方法来解决此问题。

Make the Documents\IIS Express folder on the network share "Always available offline". This uses the Offline Storage feature of Windows to locally cache the network folder and bi-directionally sync changes whenever the network share is available.

使网络共享上的Documents \ IIS Express文件夹“始终可脱机使用”。这使用Windows的脱机存储功能在本地缓存网络文件夹,并在网络共享可用时双向同步更改。

In fact, it's probably better to make the entire Documents folder "Always available offline" to avoid potential problems with other applications that store their user data there and expect that data to always be available.

实际上,最好使整个Documents文件夹“始终可脱机使用”,以避免在其中存储用户数据的其他应用程序的潜在问题,并期望数据始终可用。