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

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

问题描述

我希望我的MVC3网络应用程序能够访问%APPDATA%(例如,在Windows 7上 C:\Users \MyUsername \ AppData \Roaming ),因为我存储了那里的配置文件。因此,我在IIS中创建了一个具有用户MyUsername标识的应用程序池,通过使用该帐户登录创建了该用户的配置文件,并打开了加载用户配置文件选项(默认情况下仍为true)。假冒已关闭。

I want my MVC3 web application to access %APPDATA% (e.g. C:\Users\MyUsername\AppData\Roaming 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)

resolve到 c:\windows \ system32 \inetsrv 而不是 C:\ Users \ Myysername \ AppData \Roaming

resolves to c:\windows\system32\inetsrv instead of C:\Users\MyUsername\AppData\Roaming.

UPDATE:更确切地说,上面的C#代码返回一个空字符串,以便路径.GetFullPath(Path.Combine(appdataDir,MyAppName))将当前路径添加到我的应用程序名称之前,产生 c:\windows \ system32 \inetsrv \\ \\ MyAppName

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:\windows\system32\inetsrv\MyAppName.

我知道我之前在Windows Server 2008 R2上使用相同的Web应用程序做了这项工作,现在我我在Windows 7上使用相同的主要7.5版本的IIS来解决这个问题。

我使用了与以前相同的程序:创建了一个新用户,以我们身份登录呃创建配置文件和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%\System32 \inetsrv \ config \ applicationHost.config 并查找< applicationPoolDefaults> 。在< processModel> 下,请确保您没有 setProfileEnvironment =false。如果这样做,请将其设置为true。

Open your %WINDIR%\System32\inetsrv\config\applicationHost.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天全站免登陆