我有一个ASP.NET MVC 4应用程序,它可以在Google Chrome和Internet Explorer中本地显示。
但是,一旦通过TFS部署到远程服务器,视图只能使用谷歌浏览器正确显示?
部署Chrome:
部署IE:
如果我使用不同的工作站访问该页面,我会怀疑IE兼容性按钮。但是,我总是只使用我自己的归属工作站。
那么,什么可以如此彻底地改变,以便通过在Visual Studio中按[F5]键并简单地运行Web应用程序在本地方便地显示页面,并在部署后将其搞砸?
我用:
下面是我的CSS和CSHTML文件(至少我认为重要的内容包括在内,并删除了我认为不重要的内容)。
的site.css
html {
background-color: #e2e2e2;
margin: 0;
padding: 0;
}
body {
background-color: #fff;
border-top: solid 10px #000;
color: #000;
font-size: .85em;
font-family: "Segoe UI", Verdana, Helvetica, Sans-Serif;
margin: 0;
padding: 0;
}
header, footer, hgroup,
nav, section {
display: block;
}
.float-left { float: left; }
.float-right { float: right; }
.clear-fix:after {
content: ".";
clear: both;
display: block;
height: 0;
visibility: hidden;
}
/* main layout
----------------------------------------------------------*/
.content-wrapper {
margin: 0 auto;
max-width: 100%;
}
#body {
background-color: #fff;
clear: both;
padding-bottom: 35px;
}
#body a { color: #000; }
#body a:hover {
background-color: #a2998a;
color: #005596;
}
#body a:link { color: #000; }
#body a:active { color: #000; }
#body a:visited { color: #000; }
.main-content {
background: url("../Images/accent.png") no-repeat;
padding-left: 10px;
padding-top: 30px;
}
.email-counter {
display: block;
font-size: 13em;
font-family: Consolas, Arial, monospace;
font-weight: bold;
text-align: center !important;
vertical-align: middle;
}
.mailbox-title {
background-color: #fff;
border: 1px solid #000 !important;
color: #000;
font-size: 2.5em;
padding-bottom: 10px;
text-align: center;
vertical-align: middle;
}
.mailbox-title a {
color: #000;
text-decoration: none;
}
.mailbox {
border: 3px solid #000;
display: inline-block;
height: auto;
margin-top: 5px;
width: 32.66%;
}
.mailboxes-indicators { height: 400px; }
header .content-wrapper { padding-top: 20px; }
footer {
clear: both;
background-color: #e2e2e2;
font-size: .8em;
height: 100px;
}
/* site title
----------------------------------------------------------*/
.site-title {
font-family: Rockwell, Consolas, "Courier New", Courier, monospace;
line-height: 600%;
margin: 0;
text-align: center;
}
.site-title a, .site-title a:hover, .site-title a:active {
background: none;
color: #c8c8c8;
outline: none;
text-decoration: none;
}
.site-title .column { display: inline-block; }
.site-title #logo {
border: none;
position: absolute;
width: 25%;
}
.site-title #page-title-container {
position: relative;
width: 133%;
}
.site-title #page-title-container #page-title {
color: #000;
font-size: 4em;
font-weight: bold;
top: -15px;
}
.site-title #page-title-container #latest-refresh-date-time {
font-size: xx-large;
text-align: center;
top: -15px;
}
#sum-of-emails-from-all-mailboxes {
border: 3px solid #000;
left: -60px;
position: relative;
width: 110%;
}
#sum-display-name {
background-color: #cadaa9;
border: 1px solid #000;
color: #000;
font-size: 2.5em;
position: relative;
}
#sum-of-emails { font-size: 8em; }
DisplayIndicators.cshtml
@model IndicateursCourriels.ViewModels.CustomerServiceIndicatorsViewModel
@{
ViewBag.Title = "DisplayIndicators";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section header {
<div class="content-wrapper">
<div class="site-title">
<div class="column">
<div id="page-title-container">
<div id="page-title">
@Html.DisplayFor(m => m.ViewTitle)
</div>
<div id="latest-refresh-date-time">
@Html.DisplayFor(m => m.LatestRefreshDateTime)
</div>
</div>
</div>
<div class="column float-right">
<div id="sum-of-emails-from-all-mailboxes">
<div class="mailbox-title">
@Html.DisplayFor(m => m.SumOfEmailsFromAllMailboxesDisplayName)
</div>
<div id="sum-of-emails" class="email-counter">
@Html.DisplayFor(m => m.SumOfEmailsFromAllMailboxes)
</div>
</div>
</div>
</div>
</div>
}
<div class="mailboxes-indicators">
<div class="mailbox">
<div class="mailbox-title">
@Html.DisplayFor(m => m.FirstMailboxName)
</div>
<div class="display-label" style="text-align: center;">
<span class="email-counter"
style="background-color: @Html.DisplayFor(m => m.FirstAlertLevelColour)">
@Html.DisplayFor(m => m.FirstEmailCount)
</span>
</div>
</div>
<div class="mailbox">
<div class="mailbox-title">
@Html.DisplayFor(m => m.SecondMailboxName)
</div>
<div class="display-label">
<span class="email-counter"
style="background-color: @Html.DisplayFor(m => m.SecondAlertLevelColour)">
@Html.DisplayFor(m => m.SecondEmailCount)
</span>
</div>
</div>
<div class="mailbox">
<div class="mailbox-title">
<a href='@Url.Action("EmailIndicatorManualInput", "CustomerServiceIndicators")'>
@Html.DisplayFor(m => m.ThirdMailboxName)
</a>
</div>
<div class="display-label" style="text-align: center;">
<span class="email-counter"
style="background-color: @Html.DisplayFor(m => m.ThirdAlertLevelColour)">
@Html.DisplayFor(m => m.ThirdEmailCount)
</span>
</div>
</div>
</div>
修改
根据Jonathan Sampson的评论,本地和远程文档模式实际上是不同的。
所以我确实将文档模式更改为IE7以用于本地WebApp实例,并且显示与远程实例相同的显示。
现在的问题是:
答案 0 :(得分:2)
正如我们在上面的评论中所确定的,原因是由于本地和远程的不同文档模式。造成这种情况的原因可能是任何事情:
x-ua-compatible
标头,或使用HTTP响应远程发送。{/ li>
x-ua-compatible
元标记加载本地或远程实例。这些是您会注意到文档模式不同的主要原因。首先检查您的开发人员工具,以确保您不仅仅是覆盖默认文档模式。
检查<header>
元标记的标记(可能是x-ua-compatible
部分)。如果在那里找不到一个,请检查那里的HTTP响应头。
答案 1 :(得分:0)
以上都不适合我。解决方案是摆脱IE中Intranet站点的兼容模式。 MS Support IE compatibility modes infos