使用 IIS Express appcmd 创建站点时如何解决 "Cannot create a file when that file already exists."?
How to troubleshoot "Cannot create a file when that file already exists." when creating a site with IIS Express appcmd?
请注意:
PS D:\> &"C:\Program Files\IIS Express\appcmd.exe" add site /name:MySite /physicalPath:C:\MySite /bindings:http/*:51000:localhost /commit
SITE object "MySite" added
APP object "MySite/" added
VDIR object "MySite/" added
ERROR ( hresult:800700b7, message:Failed to commit configuration changes.
Cannot create a file when that file already exists.
)
最郁闷的是,以前一周左右还可以,现在不行了。
找到原因了。 %USERPROFILE%\Documents\IISExpress\config\applicationhost.config 包含我尝试添加的站点的 <location>
项。这导致了错误。
请注意:
PS D:\> &"C:\Program Files\IIS Express\appcmd.exe" add site /name:MySite /physicalPath:C:\MySite /bindings:http/*:51000:localhost /commit
SITE object "MySite" added
APP object "MySite/" added
VDIR object "MySite/" added
ERROR ( hresult:800700b7, message:Failed to commit configuration changes.
Cannot create a file when that file already exists.
)
最郁闷的是,以前一周左右还可以,现在不行了。
找到原因了。 %USERPROFILE%\Documents\IISExpress\config\applicationhost.config 包含我尝试添加的站点的 <location>
项。这导致了错误。