c# - asp.net 部署 - 找不到 Main.Master.cs 文件

标签 c# asp.net azure

我目前正在 azure 上部署我的网站。我的一个页面工作正常,但我有另一个使用母版页的页面,该页面未加载,因为我收到此错误:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

Parser Error Message: The file '/Main.master.cs' does not exist.

Source Error: 


Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="ThirdEye.Main" %>
Line 2:  
Line 3:  <%@ Register Src="~/controls/Footer.ascx" TagName="Footer" TagPrefix="ThirdEye" %>

Source File: /Main.master    Line: 1 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272

我不知道我哪里做错了。我已经上传了可执行文件,页面位于 bin 文件夹的同一目录中。您认为我必须在 CodeFile 属性或 Inherits 属性前面添加句点或波浪号吗?

我正在使用.net框架v4。我无法使用 3.5,我认为这不应该是问题所在。

主.Master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="Main" %>

Main.Master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using ThirdEye;

public partial class Main : System.Web.UI.MasterPage
    {....

最佳答案

您使用的是 Web 应用程序项目(而不是网站项目)吗?如果是这样,将 CodeFile 更改为 CodeBehind 应该可以解决该错误。

Web 应用程序部署经过编译,不包含使用 CodeFile 时所需的原始 cs 文件。

关于c# - asp.net 部署 - 找不到 Main.Master.cs 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10437371/

相关文章:

企业级应用程序的 ASP.NET 与 DotNetNuke (DNN)

Azure:如何使用通用 Terraform 脚本根据输入自动创建资源组?

c# - 类、结构或接口(interface)成员声明中的无效标记 'return'

c# - 如何在 MVVMcross iOS 上使用反向可见性绑定(bind)?

C# 套接字 TCP 客户端/服务器

asp.net - 我应该将 asp.net 应用程序的日志文件放在哪里?

c# - Action<T> 和非参数方法

javascript - 无法使用javascript获取值(value)

java - 如何推迟事件触发/接收

c# - Azure WebJob 访问被拒绝