使用注册为 allowDefinition='MachineToApplication' 的部分是错误的 [英] It is an error to use a section registered as allowDefinition='MachineToApplication'

查看:76
本文介绍了使用注册为 allowDefinition='MachineToApplication' 的部分是错误的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试发布 Web 应用程序时,我使用的是 Visual Studio 2012,但出现以下错误:

Error 1 在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的部分是错误的.此错误可能是由于虚拟目录未配置为 IIS 中的应用程序所致.E:\Temp\BUILD\Debug\AspnetCompileMerge\Source\bin\web.config 24 0 像素化

这是输出窗口的内容:

1>------ 构建开始:项目:像素化,配置:调试任何 CPU ------1>无法解决System.Core,Version=3.5.0.0,Culture=neutral,PublicKeyToken=969db8053d3322ac,Retargetable=Yes"和System.Core,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e"之间的冲突.任意选择System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes".1>无法解决System.ServiceModel.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"和System.ServiceModel.Web,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e"之间的冲突.任意选择System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".1>像素化 ->[...]\bin\TwistedPixel.Pixelate.dll1>'[...]\bin'1>CMD.EXE 以上述路径作为当前目录启动.1>不支持 UNC 路径.默认为 Windows 目录.2>------ 发布开始:项目:像素化,配置:调试任何 CPU ------2>连接到 [...]...2> 使用 [...]\Web.Debug.config 将 Web.config 转换为 E:\Temp\BUILD\Debug\TransformWebConfig\transformed\Web.config.2>Transformed[...]\Web.config 使用 [...]\bin\Web.Debug.config 到 E:\Temp\BUILD\Debug\TransformWebConfig\transformed\bin\Web.config.2>将所有文件复制到下面的临时位置以进行打包/发布: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\TempBuildDir2>E:\Temp\BUILD\Debug\AspnetCompileMerge\Source\bin\web.config(24,0): Error ASPCONFIG: 在应用程序级别之外使用注册为 allowDefinition='MachineToApplication' 的部分是错误的.此错误可能是由于虚拟目录未配置为 IIS 中的应用程序所致.2>========== 构建:1 成功,0 失败,2 最新,0 跳过 ==================== 发布:0 成功,1 失败,0 跳过 ==========

如果有人能解释为什么会发生这种情况以及如何解决它,那就太好了.

我尝试清理和重建(重建正常)我尝试删除 bin、obj 并移动临时输出目录 - 错误仍然存​​在.

解决方案

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

删除它,你应该很高兴.不过可能会在以后的发布中再次出现.

I'm using visual studio 2012 when I try to publish my web application I get the following error:

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

Here is the contents of the output window:

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 ==========

If anyone can shed some light onto why this is happening and how to fix it, that would be great.

I have tried cleaning and rebuilding (it rebuilds fine) I have tried deleting the bin, obj and have move the temp output directory - still the error persists.

解决方案

This is a problem with an extra web.config being created by the Publish process. Hover over the tab for the web.config and you'll see the extra file's location that you can then clean out. Might even be for a different configuration but it still throws the error (e.g. Debug vs. Release) Probably in something like <app>\obj\Release\Package\PackageTmp\web.config.

Delete it and you should be good to go. Might recur on later publishes though.

这篇关于使用注册为 allowDefinition='MachineToApplication' 的部分是错误的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆