VirtualPath不在当前的应用程序根目录中

背景:使用VB.NET后端的ASP.NET Webforms应用程序。

我刚刚从Visual Studio 2010升级到Visual Studio 2013和.NET 4.5.1。 由于我们在Visual Studio 2005和.NET 2.0上,此代码用于工作。 但自升级以来,我得到这个错误。

在ASCX用户控件中。

<script language="javascript" type="text/javascript"> <!-- function SetItem_<%Response.Write(m_strJSAlias)%>(strValue) { $("#<%Response.Write(txtShop.ClientID)%>").attr('value',strValue); __doPostBack('frmCorpPortal_Form',''); void FocusOnNext_<%response.Write(m_strJSAlias)%>; } 

我们现在得到这个我们从未有过的错误:

 VirtualPath was outside the current application root. Parameter name: virtualPath Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentException: VirtualPath was outside the current application root. Parameter name: virtualPath Line 4: <script language="javascript" type="text/javascript"> Line 5: <!-- Line 6: function SetItem_<%Response.Write(m_strJSAlias)%>(strValue) { Line 7: $("#<%Response.Write(txtShop.ClientID)%>").attr('value',strValue); Line 8: __doPostBack('frmCorpPortal_Form',''); 

如果我使用这个文件并做出无意义的改变,错误就会消失。 例如:在第4行和第5行之间添加一个空白行。然后稍后再回来。

什么可能导致这个?

我在iis中的一个旧应用程序,并从Visual Studio中运行时遇到同样的问题。 禁用visual studio 2013中的浏览器链接似乎解决了这个问题。 此function注入一些JavaScript到您的页面,至less导致这个问题。 由于我现在禁用它,它在IIS和Visual Studio中工作。

http://techatplay.wordpress.com/2013/10/24/vs2013-asp-net-application-error-virtualpath-was-outside-the-current-application-root/

关于这个function的更多细节

http://blogs.msdn.com/b/webdev/archive/2013/06/28/browser-link-feature-in-visual-studio-preview-2013.aspx

欢呼声,克罗克

禁用visual studio 2013中的浏览器链接解决了这个问题,只需取消选中“启用浏览器链接”(靠近“运行”button)

跑过这个,起初我没有看到在哪里点击,因为我有项目运行。

这里是一个截图“在Visual Studio 2013中禁用浏览器链接似乎解决了这个问题。

在这里输入图像说明

我在我的Web应用程序项目设置中有一个不正确的URL。 更新设置使用我的本地IIS中正确的地址纠正了我的问题。

问题出现在我身上,因为我在IIS中configuration了与在项目属性中指定的不同的虚拟目录。 我还注意到,打开重新打开解决scheme会自动在IIS中创build一个工作的虚拟目录

p