但是当我用IIS发布的时候,样式都没有了
这是我的 BundleConfig.cs
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
"~/Scripts/knockout-2.1.0.js",
"~/Scripts/knockout-2.1.0.debug.js"));
// 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 StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
}
}
这是我的页面:
@model newInOut.Models.Employees_Master
@{
ViewBag.Title = "Login";
Layout = null;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="~/Content/LoginStyle.css" rel="stylesheet" />
<div class="flex-container">
@using (Html.BeginForm("Login", "HR", FormMethod.Post, new { @class = "login" }))
{
<div class="logo text-uppercase"><span>Kita</span><strong class="logo text-primary">MerX</strong></div>
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<table>
<tr>
<td>@Html.TextBoxFor(a => a.EmployeeID, new { @class = "fa fa-user", placeholder = "ID", style = "font-size:24px" }) </td>
<td class="fa fa-user"style="font-size:24px"></td>
<td>@Html.ValidationMessageFor(a => a.EmployeeID)</td>
</tr>
<tr>
<td>@Html.TextBoxFor(a => a.Employee_Password, new { @class = "fa fa-key", placeholder = "Password", @type = "Password" }) </td>
<td class="fa fa-key" style="font-size:24px"></td>
<td>@Html.ValidationMessageFor(a => a.Employee_Password)</td>
</tr>
<tr>
<td> <button type="submit" value="Login" class="state">LOGIN</button></td>
</tr>
</table>
}</div>
我尝试关注 this但它没有解决它。
我使用了 Publish
,然后在 Profile
选项卡中,我创建了一个新的 Publish Profile
,
然后我将发布方法用作文件系统
,将我的目标位置放在wwwroot
文件夹中,然后在设置
选项卡中,我使用了Release
。
然后在IIS管理器中,我把新建的文件夹转成App,然后浏览。
最佳答案
此外,您似乎没有在页面上包含样式包“~/Content/css”。使用 @Styles.render("~/Content/css")
来包含 bundle.config 中定义的 css 包。
关于css - 当我使用 IIS 部署我的 mvc 应用程序时,网页样式消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45729258/