我尝试在IIS7中运行ASP.NET MVC5,但是网站只显示我的cshtml的文本。MVC 5在IIS 7中不工作
我的配置:
GoWireless>基本设置>选择(.NET Framework版本:没有管理控制台,管道模式:经典)
GoWireless>目录浏览>已启用
Index.cshtml仅显示此文本
@model IEnumerable @ {Vi ewBag.Title =“Active Directory”; } Active Directory
欢迎,@ User.Identity.Name.Remove(0,User.Identity.Name.IndexOf(“\”) + 1)!
这是GoWireless活动目录搜索器,您可以使用搜索框 或点击左上角的其中一个员工以查看 员工的详细信息。如果您想搜索只存在于GoWireless \ ActiveDirectory中并且不存在于GW_UTA \ ActiveDirectory2 中的 用户,则可以以完整格式输入并搜索他的\详细信息(SamAccountName, GivenName,Surname,Email或EmployeeNumber)中的一个到 搜索框。
了解更多
_Layout.cshtml只显示这段文字
@model IEnumerable
Toggle navigation Failed to load images
@User.Identity.Name
@using (Html.BeginForm("Index", "Home", FormMethod.Post)) {
@Html.TextBox("search", null, new { @class = "form-control", @placeholder = "Search..." })
}
@foreach (var item in Model) {
class="active"} href='@Url.Action("Details", "Home", new { id = item.SamAccountName.Replace(".", "_") })'>@item.SamAccountName
ViewBag.count = 1; } @if (ViewBag.count != 1) { EasyAD.EasyAD ad = new EasyAD.EasyAD("dc1.gowireless.net:389", "gowireless\\ldapuser", "[email protected]#"); System.Data.DataTable dt = ad.GetUsers(ViewBag.search); var count = 0; while (count < dt.Rows.Count) { if (dt.Rows[count]["SamAccountName"].ToString() != null && dt.Rows[count]["SamAccountName"].ToString() !="") {
class="active"} href='@Url.Action("Details", "Home", new { id = dt.Rows[count]["SamAccountName"].ToString().Replace(".", "_") })'>@dt.Rows[count]["SamAccountName"]
} else { ViewBag.warning = 1; } count++; } if (dt.Rows.Count <= 0) { ViewBag.count = 0; } }
@RenderBody() @if (ViewBag.warning == 1) {
× Warning! someone is containing the employee @ViewBag.search without SamAccountName, Please check manually the GoWireless\\ActiveDirectory.
} @if (ViewBag.success == 1) {
× Well Done! @ViewBag.search is successfully updated in ga_uta\\activedirectory.
} @if (ViewBag.count == 0) {
× Heads Up! @ViewBag.search is not exist in GW_UTA or GoWireless, maybe you are missing something?
} @if (ViewBag.error == 1) {
Oh Snap!
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum tincidunt est vitae ultrices accumsan. Aliquam ornare lacus adipiscing, posuere lectus et, fringilla augue.
Some Error Accured
}
它应该是这样的
http://cdonner.com/mvc-5-on-windows-server-2008iis-7。htm – 2014-10-04 14:08:03
@Evgeni谢谢你,我的问题完成了:D – 2014-10-07 02:39:05