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

标签 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, 然后我将发布方法用作文件系统,将我的目标位置放在wwwroot文件夹中,然后在设置选项卡中,我使用了Release。 然后在IIS管理器中,我把新建的文件夹转成App,然后浏览。

最佳答案

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

关于css - 当我使用 IIS 部署我的 mvc 应用程序时,网页样式消失了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45729258/

相关文章:

Safari 6 中的 CSS 边框半径问题

php - 无法连接到 MySql

c# - MVC core MSI builder,如何创建安装程序?

node.js - 在 openshift 上运行 node.js sails 应用程序

asp.net - IIS 6 不提供 asp.net 1.1 页面?

mysql - 将实时数据库复制到开发服务器

html - 对称排列绝对定位元素

CSS 色相旋转使图像变暗

javascript - CSS - AOS 动画库 - 为什么滑入式动画破坏了我整个页面的宽度?

asp.net - 带有 HTTP header 的 URL 重写规则