从 VS2010 发布时出现 allowDefinition='MachineToApplication' 错误(但仅在之前的构建之后) [英] allowDefinition='MachineToApplication' error when publishing from VS2010 (but only after a previous build)

查看:27
本文介绍了从 VS2010 发布时出现 allowDefinition='MachineToApplication' 错误(但仅在之前的构建之后)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在本地计算机上运行我的 Asp.Net MVC 2 应用程序而不会出现问题.只需运行/调试.

I can run my Asp.Net MVC 2 application without an issue on my local computer. Just Run / Debug.

但是如果我已经构建了它,我不能发布它!我必须清理解决方案并再次发布.我知道这不是系统关键,但它真的很烦人.一键发布"不是干净的解决方案,然后一键发布"

But if I have already built it, I can't publish it! I have to clean the solution and publish it again. I know this is not system critical, but it's really annoying. "One Click Publish" is not "Clean solution and then One click publish"

具体错误如下:

错误 11 使用 a 是错误的部分注册为allowDefinition='MachineToApplication'超越应用层面.这个错误可能是由虚拟目录引起的未配置为应用程序在 IIS 中.

Error 11 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.

我怀疑这与 Views 文件夹中的 Web.Config 有关,但为什么只有在我之前构建一次之后.需要注意的是,该应用发布后运行良好.

推荐答案

我的 MVC 应用程序遇到了同样的问题.这很令人沮丧,因为我仍然希望检查我的视图,所以我不想关闭 MvcBuildViews

i had the same problem with my MVC apps. it was frustrating because i still wanted my views to be checked, so i didn't want to turn off MvcBuildViews

幸运的是我遇到了一个 post 这给了我答案.将 MvcBuildViews 保持为 true,然后您可以在项目文件下方添加以下行:

luckily i came across a post which gave me the answer. keep the MvcBuildViews as true, then you can add the following line underneath in your project file:

<BaseIntermediateOutputPath>[SomeKnownLocationIHaveAccessTo]</BaseIntermediateOutputPath>

并使该文件夹不在您的项目文件夹中.为我工作.这不是一个完美的解决方案,但暂时是好的.确保从项目文件夹中删除 package 文件夹(位于 objDebug 和/或 objRelease 文件夹内),否则将不断收到错误.

And make that folder not in your project's folder. Works for me. It's not a perfect solution, but it's good for the moment. Make sure you remove the package folder (located inside the objDebug and/or objRelease folder) from your project folder otherwise you'll keep getting the error.

FWIW,MS 知道这个错误...

这篇关于从 VS2010 发布时出现 allowDefinition='MachineToApplication' 错误(但仅在之前的构建之后)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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