预编译 ASP.NET 应用程序失败 (web.config)
我尝试在发布时从 Visual Studio 内部构建后编译应用程序,但它总是失败。如果我不尝试预编译,应用程序构建得很好。我也尝试过从命令行编译它,但它也不起作用。
VS 和命令行中的错误消息或多或少相同,这是命令行错误: web.config(31): error ASPCONFIG: 在应用程序级别之外使用注册为allow Definition='MachineToApplication' 的部分是错误的。此错误可能是由于未将虚拟目录配置为 IIS 中的应用程序而导致的。
我已经尝试了搜索此错误时发现的常用解决方案:
- 在 IIS 中创建应用程序(这已经完成,在新文件夹上再次尝试,没有区别)
- 删除多余的 web.config 文件,这没有区别。
-删除 obj 文件夹,这也没有什么区别。
我现在想知道这是否是因为 web.config 第 31 行中的内容:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
但是删除它也没有任何区别。我正在从安装了 VS2010 的工作站编译此应用程序,它旨在运行在 IIS 6.0 和 NET 框架的 W2k3 SBS Web 服务器上。我不确定这是否会导致此错误,我使用的命令行命令如下所示:
aspnet_compiler -v /AppName -p "C:\Users\xxx\Documents\Visual Studio 2010\Projects\AppName" "\\WebServerName\Inetpub\wwwroot\AppNameFolder"
I have tried compiling the application after build from inside visual studio when publishing, it always fails. The application builds fine if I do not try to precompile. I've also tried compiling it from the command line but it has not worked either.
The error message is more or less the same in both VS and command line, here's the command line error:
web.config(31): error ASPCONFIG: It is an error to use a section registered as allow Definition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I have tried the usual solutions that I have found searching for this error:
-creating the application in IIS (this was already done, tried it again on a new folder, no difference)
-removing surplus web.config files, this made no difference.
-removing the obj folder, this made no difference either.
I am now wondering if it's because of what it says in web.config, line 31:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
However removing this is not making any difference either. I am compiling this application from a workstation that has VS2010 installed on it, it's meant to go on a W2k3 SBS webserver that's IIS 6.0 and the NET framework. I am not sure if that can cause this error, the command line command I am using looks like this:
aspnet_compiler -v /AppName -p "C:\Users\xxx\Documents\Visual Studio 2010\Projects\AppName" "\\WebServerName\Inetpub\wwwroot\AppNameFolder"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论