我嘗試在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