我几个小时以来一直在撞击岩石。我正在开发一个ASP.Net Core 2.0 MVC Web应用程序,并使用Nginx在Ubuntu 16.04上运行它。一切都很美妙,直到我在生产中运行时打开任何类型的模态对话框。调试对话框时工作完美。它们打开和关闭,没有错误或问题。但是,在生产环境中打开它们时,页面内容会消失,浏览器就像永远加载页面一样。当我查看调试器时,Firebug或Chrome中没有显示错误。我用Google搜索并用Google搜索....
有人有什么想法吗?以下是模态的代码:
@model IEnumerable<erp_jbitpro_cloud.Models.Customers.Customer>
@{
Layout = "_LayoutPart";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
</head>
<body>
<script>
$(document).ready(function () {
debugger;
var url = "";
});
</script>
<p>
<a asp-action="Create" class="newPopup btn btn-primary" data-toggle="modal" data-target="#editPopup">Create New</a> |
<a asp-action="Index" asp-controller="CustomerMgmnt" class="btn btn-primary">Back to Customer Management...</a>
</p>
<table class="table table-striped">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model => model.CustomerName)
</th>
<th>
@Html.DisplayNameFor(model => model.Address1)
</th>
<th>
@Html.DisplayNameFor(model => model.Address2)
</th>
<th>
@Html.DisplayNameFor(model => model.City)
</th>
<th>
@Html.DisplayNameFor(model => model.ZipCode)
</th>
<th>
@Html.DisplayNameFor(model => model.Phone)
</th>
<th>
@Html.DisplayNameFor(model => model.Website)
</th>
<th>
@Html.DisplayNameFor(model => model.State)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<td>
@Html.DisplayFor(modelItem => item.CustomerName)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address1)
</td>
<td>
@Html.DisplayFor(modelItem => item.Address2)
</td>
<td>
@Html.DisplayFor(modelItem => item.City)
</td>
<td>
@Html.DisplayFor(modelItem => item.ZipCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.Phone)
</td>
<td>
@Html.DisplayFor(modelItem => item.Website)
</td>
<td>
@Html.DisplayFor(modelItem => item.State.Abbr)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.CustomerId" class="editPopup btn btn-success" data-toggle="modal" data-target="#editPopup">Edit</a> |
<a asp-action="Details" asp-route-id="@item.CustomerId" class="detailsPopup btn btn-default">Details</a>
</td>
</tr>
}
</tbody>
</table>
<div class="modal fade" id="editPopup" role="dialog" aria-labelledby="mylabel">
<div class="modal-dialog">
<div class="modal-content">
</div>
</div>
</div>
<div class="newDialog">
</div>
<div class="detailsDialog">
</div>
</body>
</html>
这是加载到模态中的部分:
@model erp_jbitpro_cloud.Models.Customers.Customer
@{
Layout = "_LayoutPart";
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Create</title>
</head>
<body>
<div class="row">
<div class="col-md-7">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="close">
<span aria-hidden="true" class="glyphicon glyphicon-remove-circle"></span>
</button>
<h4 class="modal-title" id="mylabel">Editor</h4>
</div>
<form asp-action="Create" class="newDialogForm">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="CustomerName" class="control-label"></label>
<input asp-for="CustomerName" class="form-control" />
<span asp-validation-for="CustomerName" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Address1" class="control-label"></label>
<input asp-for="Address1" class="form-control" />
<span asp-validation-for="Address1" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Address2" class="control-label"></label>
<input asp-for="Address2" class="form-control" />
<span asp-validation-for="Address2" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="City" class="control-label"></label>
<input asp-for="City" class="form-control" />
<span asp-validation-for="City" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="StateId" class="control-label"></label>
<select asp-for="StateId" class="form-control" asp-items="ViewBag.StateId"></select>
</div>
<div class="form-group">
<label asp-for="ZipCode" class="control-label"></label>
<input asp-for="ZipCode" class="form-control" />
<span asp-validation-for="ZipCode" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Phone" class="control-label"></label>
<input asp-for="Phone" class="form-control" />
<span asp-validation-for="Phone" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Website" class="control-label"></label>
<input asp-for="Website" class="form-control" />
<span asp-validation-for="Website" class="text-danger"></span>
</div>
<div class="form-group modal-footer">
<input type="submit" value="Create" class="btn btn-success" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</form>
</div>
</div>
</body>
</html>
任何人都对这里会发生什么有什么想法?
答案 0 :(得分:0)
哇!所以我解决了这个问题,感谢@shyju提出的建议!问题是css文件获得了状态304.我使用了生产站点的模板_Layout文件的默认链接,一旦我更改了这些链接,现在所有东西都在生产中。只是为了清楚解决了什么问题,请参阅下面的代码:
原件:
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
修正了它:
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />