当我使用IIS部署我的mvc应用程序时,网页样式消失了

时间:2017-08-17 07:42:13

标签: css iis deployment publish

每当我调试我的网络应用程序时,它都显示如下: 01

但是当我使用IIS发布它时,样式消失了

enter image description here

这是我的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, 然后我将发布方法用作File System,将我的目标位置放在wwwroot文件夹中,然后在Settings标签中,我使用了Release。 然后在IIS管理器中,我将新创建的文件夹转换为App,然后浏览它。

1 个答案:

答案 0 :(得分:0)

此外,您似乎没有在页面上包含stylebundle“〜/ Content / css”。使用@Styles.render("~/Content/css")包含bundle.config中定义的css包。