Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Web.Config运行时错误,'/';应用_C#_Asp.net_.net - Fatal编程技术网

C# Web.Config运行时错误,'/';应用

C# Web.Config运行时错误,'/';应用,c#,asp.net,.net,C#,Asp.net,.net,我正在尝试创建一个非常简单的asp.net母版网站,在我上传到主机之前一切都很顺利。使用以下web.config <?xml version="1.0"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> &l

我正在尝试创建一个非常简单的asp.net母版网站,在我上传到主机之前一切都很顺利。使用以下web.config

<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
</configuration> 
描述:执行当前web请求期间发生未处理的异常。请查看堆栈跟踪以了解有关错误的更多信息以及错误在代码中的起源

Exception Details: System.Web.HttpException: Cannot find ContentPlaceHolder 'bodyPL' in the master page '/MasterPage.master', verify content control's ContentPlaceHolderID attribute in the content page.
源错误:

在执行当前web请求期间生成了未经处理的异常。有关异常的起源和位置的信息可以使用下面的异常堆栈跟踪来识别

堆栈跟踪:

[HttpException (0x80004005): Cannot find ContentPlaceHolder 'bodyPL' in the master page '/MasterPage.master', verify content control's ContentPlaceHolderID attribute in the content page.]
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +797
   System.Web.UI.Page.get_Master() +54
   System.Web.UI.Page.ApplyMasterPage() +14
   System.Web.UI.Page.PerformPreInit() +45
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +335

版本信息:Microsoft.NET Framework版本:4.0.30319;ASP.NET版本:4.0.30319.34249

尝试为ContentPlaceHolder控件提供一个类似“body”的新id,然后重置ContentPlaceHolder控件的ContentPlaceHolder id属性,看看这会给您带来什么,我也看不出有什么问题

编译项目时是否存在生成错误

顺便说一句,如果你不知道,道歉,如果你知道

自定义错误是web配置中可以设置的设置

关闭-将显示.net错误消息,如您看到的错误消息

打开-这将允许您为特定错误代码指定重定向到自定义页面,例如:

RemoteOnly-这将允许您在网站所在的服务器上查看错误消息,但仍会向访问者显示自定义错误页面

同样值得一提的是:您可以为错误设置默认url

进一步阅读:


希望这能有所帮助。

尝试为ContentPlaceHolder控件提供一个新的id,比如“body”,然后重置ContentPlaceHolder控件的ContentPlaceHolder id属性,看看这会给您带来什么,我也看不出有什么问题

编译项目时是否存在生成错误

顺便说一句,如果你不知道,道歉,如果你知道

自定义错误是web配置中可以设置的设置

关闭-将显示.net错误消息,如您看到的错误消息

打开-这将允许您为特定错误代码指定重定向到自定义页面,例如:

RemoteOnly-这将允许您在网站所在的服务器上查看错误消息,但仍会向访问者显示自定义错误页面

同样值得一提的是:您可以为错误设置默认url

进一步阅读:


希望这有帮助。

如果它在本地环境中工作,而不是在主机上工作,则可能是在主机环境中工作。确认应用程序池已设置为使用正确的.net framework运行。此外,确认托管管道模式为“集成”


是否存在名为“bodyPL”的元素?

如果它在本地环境而不是主机上工作,则可能是主机环境。请确认应用程序池已设置为使用正确的.net framework运行。此外,请确认托管管道模式为“集成”


是否有一个名为“bodyPL”的元素?

我更改了母版页上的ContentPlaceHolder ID和default.aspx上的ContentPlaceHolder ID,没有运气,得到了相同的错误。不,我在VisualStudio2013中编译时并没有出错,只是在上传到主机之后。奇怪吧!请发布您在浏览器中看到的错误消息好吗?我更改了母版页上的ContentPlaceHolder ID和default.aspx上的ContentPlaceHolder ID,不走运,得到了相同的错误。不,我在VisualStudio2013中编译时并没有出错,只是在上传到主机之后。奇怪吧!你能把你在浏览器中看到的错误信息贴出来吗?母版页上有“bodyPL”吗?如果没有,那就可以解释了。@t请将此
添加到母版页和默认页的内容上方。母版页中是否有“bodyPL”?如果不是这样,那就可以解释了。@t请将此
添加到contentIIS:7.0、ASP.Net运行时版本:4.0/4.5的主控和默认页上,管道处于集成模式。我和主持人(戈达迪)谈过,他们没有发现任何问题。我在一个非母版网站上进行了测试,效果很好。根据前面的建议,我将ContentPlaceHodler ID更改为bodyPLIIS:7.0,ASP.Net运行时版本:4.0/4.5,管道处于集成模式。我和主持人(戈达迪)谈过,他们没有发现任何问题。我在一个非母版网站上进行了测试,效果很好。根据前面的建议,我将ContentPlaceHodler ID更改为bodyPL
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>test_configprob02</title></head>
<body>
<form id="mainForm" runat="server">

    <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

    </asp:ContentPlaceHolder>

</form></body></html>
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>Lorem ipsum dolor  ipsum.</p>
</asp:Content>
Cannot find ContentPlaceHolder 'bodyPL' in the master page '/MasterPage.master', verify content control's ContentPlaceHolderID attribute in the content page.
Exception Details: System.Web.HttpException: Cannot find ContentPlaceHolder 'bodyPL' in the master page '/MasterPage.master', verify content control's ContentPlaceHolderID attribute in the content page.
[HttpException (0x80004005): Cannot find ContentPlaceHolder 'bodyPL' in the master page '/MasterPage.master', verify content control's ContentPlaceHolderID attribute in the content page.]
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +797
   System.Web.UI.Page.get_Master() +54
   System.Web.UI.Page.ApplyMasterPage() +14
   System.Web.UI.Page.PerformPreInit() +45
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +335