IIS 7.5 应用程序池将错误的 %APPDATA% 用于自定义用户作为标识 [英] IIS 7.5 application pool uses wrong %APPDATA% for custom user as identity

查看:21
本文介绍了IIS 7.5 应用程序池将错误的 %APPDATA% 用于自定义用户作为标识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的 MVC3 Web 应用程序访问 %APPDATA%(例如 Windows 7 上的 C:UsersMyUsernameAppDataRoaming),因为我将配置文件存储在那里.因此,我在 IIS 中以用户MyUsername"的身份创建了一个应用程序池,通过使用该帐户登录创建了该用户的配置文件,并打开了加载用户配置文件"选项(无论如何默认为 true).模拟功能已关闭.

I want my MVC3 web application to access %APPDATA% (e.g. C:UsersMyUsernameAppDataRoaming on Windows 7) because I store configuration files there. Therefore I created an application pool in IIS with the identity of the user "MyUsername", created that user's profile by logging in with the account, and turned on the option "Load User Profile" (was true by default anyway). Impersonation is turned off.

现在我遇到了 %APPDATA%(在 C# 中)的问题:

Now I have the problem that %APPDATA% (in C#):

appdataDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)

解析为 c:windowssystem32inetsrv 而不是 C:UsersMyUsernameAppDataRoaming.

UPDATE: 更准确地说,上面的 C# 代码返回一个空字符串,因此 Path.GetFullPath(Path.Combine(appdataDir, "MyAppName"))我的应用程序名称的当前路径,结果为 c:windowssystem32inetsrvMyAppName.

UPDATE: More exactly, the above C# code returns an empty string, so that Path.GetFullPath(Path.Combine(appdataDir, "MyAppName")) prepends the current path to my application name, resulting in c:windowssystem32inetsrvMyAppName.

我知道我之前在 Windows Server 2008 R2 上使用相同的 Web 应用程序完成了这项工作,现在我在 Windows 7 上使用相同的 IIS 7.5 主要版本遇到了这个问题.
我使用了与之前相同的过程:创建一个新用户,以该用户身份登录以创建配置文件和 APPDATA 目录,然后使用此身份添加应用程序池,最后将 Web 应用程序添加到此池中.

I know I made this work before with the same web application on a Windows Server 2008 R2, and now I'm getting this problem with the same major version 7.5 of IIS on my Windows 7.
I used the same procedure as before: Created a new user, logged in as that user to create the profile and APPDATA directories, then added the application pool with this identity and finally added the web application to this pool.

有什么想法吗?

推荐答案

打开你的 %WINDIR%System32inetsrvconfigapplicationHost.config 并查找 .在 下,确保您没有 setProfileEnvironment="false".如果这样做,请将其设置为 true.

Open your %WINDIR%System32inetsrvconfigapplicationHost.config and look for <applicationPoolDefaults>. Under <processModel>, make sure you don't have setProfileEnvironment="false". If you do, set it to true.

这篇关于IIS 7.5 应用程序池将错误的 %APPDATA% 用于自定义用户作为标识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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