ASP.NET网站上的本地主机错误
在本地主机上运行我的ASP.NET网站时,我遇到以下错误ASP.NET网站上的本地主机错误,asp.net,visual-studio-2010,iis,localhost,parse-error,Asp.net,Visual Studio 2010,Iis,Localhost,Parse Error,在本地主机上运行我的ASP.NET网站时,我遇到以下错误 Parser Error Message: The file '/MPage.master' does not exist. Line 1: <%@ page title="" language="VB" masterpagefile="~/MPage.master" autoeventwireup="false" inherits="Page1, App_Web_rscnlqny" %> 分析器错误消息:文件“/MPa
Parser Error Message: The file '/MPage.master' does not exist.
Line 1: <%@ page title="" language="VB" masterpagefile="~/MPage.master" autoeventwireup="false" inherits="Page1, App_Web_rscnlqny" %>
分析器错误消息:文件“/MPage.master”不存在。
第1行:
我可以使用以下方法解决此问题:
<%@ page title="" language="VB" masterpagefile="./MPage.master" autoeventwireup="false" inherits="Page1, App_Web_rscnlqny" %>
但这样做之后,我得到了一个错误:
Parser Error Message: Could not load the assembly 'App_Web_hipf5z3e'. Make sure that it is compiled before accessing the page.
Line 1: <%@ master language="VB" inherits="MPage, App_Web_hipf5z3e" %>
分析器错误消息:无法加载程序集“App\u Web\u hipf5z3e”。在访问页面之前,请确保已对其进行编译。
第1行:
如何修复此问题???当您获取预编译的aspx页面并将其作为未编译的页面进行编辑时,也会发生这种情况,例如从Live server复制该页面并覆盖您的开发/工作版本 在aspx页面的
标记的第一行,您可能会看到如下属性:
inherits="yourPageClass, App_Web_hipf5z3e".
删除App\u Web\u XXXX部分
并添加指向代码隐藏文件的CodeFile属性:
CodeFile="yourPageFile.aspx.cs"
新答案:
您可以在同一个项目中混合使用C#和VB…但不能在同一个页面中使用。
编辑Web.config
现在我得到:解析器错误消息:代码文件的语言与页面的语言不一致。第1行:但在代码文件中,您使用的是c#-CodeFile=“MPage.master.cs”
我的是vb-CodeFile=“MPage.master.vb”
<compilation debug="false">
<codeSubDirectories>
<add directoryName="VBCode"/>
<add directoryName="CSCode"/>
</codeSubDirectories>
</compliation>