将web站点部署在网络映射硬盘上,会出现无法访问web.config的错误,其实就是IIS无法访问整个站点。解决的关键是在两台服务器上都设置同一个用户,有相同的用户名和密码,并让该web程序以这个用户为匿名访问用户。(可以是本地用户,也可以是域用户)注意的是,这里的两台服务器都在同一个域里。如果不在同一个域里,还没经过测试是否能用。
需要注意的是,在该web程序中要访问本地文件路径,不能用映射的磁盘名称Y:\\,而需要使用UNC路径,如\\172.0.0.66\SharedFolder\log.txt.
具体步骤如下:
1. start from the "Run" option the "gpedit.msc", then expand in the left panel
"计算机配置" -> "Windows 设置" -> "安全设置" -> "账户策略" -> "密码策略"
then double click in the content panel the
"密码必须符合复杂性要求"
to disable this security rule.
2. right click the computer icon in the explorer, choose the "Manage" command from the context menu, and
create such an account
name: Test
password: 123
and remember to choose "密码用不过期" and "用户不允许更改密码" option before quit.
3. copy the content (i.e., the "bin" and "default.aspx" and "web.config") of the web application, to the mapped
disk "Y:".
4. start IIS manager, make sure choosing the root node in the left panel, and switch to functionality view in
the content panel, then double-click the
"ISAPI 和 CGI 限制"
and make sure if all the "ASP.NET 4.0 ..." are allowed.
5. stay in IIS manager, click in the left panel the "Application Pool", then find out the applications of the name
"website1" or "website2", etc.
choose it and click the "Advanced Configuration" in the right panel, then set the "Identity" of it to that new user
"Test"
6. again in IIS manager, choose in the left panel the site
"website1" or "website2", etc.
and click in the right panel the "Basic Configuration", then fill the "Physical Path" with the shared folder assigned
to the current server (i.e., the UNC path of the mapped disk "Y:"), e.g.,
and click the button "Test connection" to guarantee the underlying application identity can access this folder.
7. right after the last step (without leaving IIS manager), switch the content panel to functionality view, and double
click the
"身份验证"
then in the result list choose the
"匿名身份验证"
and click the "Edit" in the right panel, choose
"应用程序池标识"
instead of the previous "IUSR".
浙公网安备 33010602011771号