gpt4 book ai didi

asp.net-mvc - ASP.NET应用程序可在VS2013中工作,但在部署时无法工作

转载 作者:行者123 更新时间:2023-12-03 07:54:29 25 4
gpt4 key购买 nike

部署程序后运行程序时遇到以下控制台错误,而使用VS2013时却未得到以下错误:

注意:更新了基于Fiddler的控制台错误输出(这是来自500状态码的响应

readyState: 4, responseText: "<!DOCTYPE h...", status: 500, statusText: "Internal Se..."}
readyState: 4
responseText:

"<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Error - My ASP.NET Application</title>
<link href="/Contentbug/css?v=MDbdFKJHBa_ctS5x4He1bMV0_RjRq8jpcIAvPpKiN6U1" rel="stylesheet"/>

<script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>


</head>
<body>


<div class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">Application name</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li><a href="/Home/About">About</a></li>
<li><a href="/Home/Contact">Contact</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="/Account/Register" id="registerLink">Register</a></li>
<li><a href="/Account/Login" id="loginLink">Log in</a></li>
</ul>

</div>
</div>
</div>
<div class="container body-content">



<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>


<hr />
<footer>
<p>&copy; 2015 - My ASP.NET Application</p>
</footer>
</div>

<script src="/bundles/jquery?v=FVs3ACwOLIVInrAl5sdzR2jrCDmVOWFbZMY6g6Q0ulE1"></script>

<script src="/bundles/bootstrap?v=2Fz3B0iizV2NnnamQFrx-NbYJNTFeBJ2GM05SilbtQU1"></script>



<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModal-label" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="myModal-label">ATTENTION: Please Review Your Custom Email Before Sending</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Edit</button>
<button type="button" class="btn btn-primary" id="sendButton" data-dismiss="modal">Send</button>
</div>
</div>
</div>
</div>



<script>
$('[name="optradio1"]').on('change', function () {
....
});
</script>

...

</body>

</html>
status: 500
statusText: "Internal Server Error"

在阅读了关于BundleConfig的一些线程之后,我对其进行了更改,以使我的软件包名称与我的目录名称之一不同,但是由于出现了相同的错误,除了更新的名称更改外,该软件包名称仍然不起作用。

有想法/建议吗?

BundleConfig
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));

// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Contentbug/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}

_layout.cshtml的一部分
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Contentbug/css")
@Scripts.Render("~/bundles/modernizr")

</head>

最佳答案

首先做这些事情。

  • 仅部署编译的代码。
  • 托管目录应为根目录(例如:www.stackoverflow.com),而不应托管在子目录(例如:www.stackoverflow.com/supraj)中。
  • 确保通过FileZilla托管(一种安全的方法)。

  • 如果这些都不起作用,如果您成功在localhost中运行,那么唯一的问题就是webconfig文件

    关于asp.net-mvc - ASP.NET应用程序可在VS2013中工作,但在部署时无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28378249/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com