首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用注册为allowDefinition='MachineToApplication‘的节是错误的

使用注册为allowDefinition='MachineToApplication‘的节是错误的
EN

Stack Overflow用户
提问于 2012-10-19 16:38:00
回答 5查看 16.1K关注 0票数 17

我正在使用visual studio 2012,当我尝试发布我的web应用程序时,我得到了以下错误:

代码语言:javascript
复制
Error   1   It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.  E:\Temp\BUILD\Debug\AspnetCompileMerge\Source\bin\web.config    24  0   Pixelate

下面是output窗口的内容:

代码语言:javascript
复制
1>------ Build started: Project: Pixelate, Configuration: Debug Any CPU ------
1>  No way to resolve conflict between "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" and "System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" arbitrarily.
1>  No way to resolve conflict between "System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "System.ServiceModel.Web, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" arbitrarily.
1>  Pixelate -> [...]\bin\TwistedPixel.Pixelate.dll
1>  '[...]\bin'
1>  CMD.EXE was started with the above path as the current directory.
1>  UNC paths are not supported.  Defaulting to Windows directory.
2>------ Publish started: Project: Pixelate, Configuration: Debug Any CPU ------
2>Connecting to [...]...
2>Transformed Web.config using [...]\Web.Debug.config into E:\Temp\BUILD\Debug\TransformWebConfig\transformed\Web.config.
2>Transformed[...]\Web.config using [...]\bin\Web.Debug.config into E:\Temp\BUILD\Debug\TransformWebConfig\transformed\bin\Web.config.
2>Copying all files to temporary location below for package/publish:
2>E:\Temp\BUILD\Debug\AspnetCompileMerge\Source.
2>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p E:\Temp\BUILD\Debug\AspnetCompileMerge\Source -c -d E:\Temp\BUILD\Debug\AspnetCompileMerge\TempBuildDir 
2>E:\Temp\BUILD\Debug\AspnetCompileMerge\Source\bin\web.config(24,0): Error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.
2>
========== Build: 1 succeeded, 0 failed, 2 up-to-date, 0 skipped ==========
========== Publish: 0 succeeded, 1 failed, 0 skipped ==========

如果有人能阐明为什么会发生这种情况,以及如何修复它,那就太好了。

我已经尝试了清理和重建(它重建正常),我已经尝试删除bin,obj,并移动临时输出目录-仍然错误仍然存在。

EN

回答 5

Stack Overflow用户

发布于 2012-11-06 23:33:18

这是一个问题,因为发布过程创建了额外的web.config。将鼠标悬停在web.config的选项卡上,您将看到额外文件的位置,然后可以将其清除。甚至可能是针对不同的配置,但它仍然会抛出错误(例如,调试与发布),可能是在类似<app>\obj\Release\Package\PackageTmp\web.config的代码中。

删除它,你就可以开始工作了。不过,可能会在以后的出版中再次出现。

票数 28
EN

Stack Overflow用户

发布于 2014-07-08 00:43:45

这似乎是一个非常常见的问题,当这是由Visual Studio中的Web发布功能创建的额外web.config导致时,错误消息绝对没有帮助。

通过强制我的ASP.NET应用程序项目在每次构建后清除obj目录,我能够克服这一点。

将以下内容添加到生成后事件中,并运行生成后事件:'Always‘

代码语言:javascript
复制
rmdir /S /Q "$(ProjectDir)\obj"
票数 9
EN

Stack Overflow用户

发布于 2012-10-19 16:40:09

您的web.config中的某个设置存在问题。该错误可能会让您对位置有一个概念。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12970376

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档