Leo*_*nto 1 c# iis-7 visual-studio-2012 asp.net-mvc-5
我尝试在IIS7中运行我的ASP.NET MVC5,但发生的是网站只显示我的cshtml文本.
我的配置:
GoWireless>基本设置>选择(.Net Framework版本:无管理控制台,管道模式:经典)
GoWireless>目录浏览>已启用
Index.cshtml仅显示此文本
@model IEnumerable @ {ViewBag.Title ="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", "abc123!@#"); 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
}
Run Code Online (Sandbox Code Playgroud)
它应该是这样的

托管模块
bin文件夹包含MVC的所有必需程序集(MVC 5不需要作为先决条件部署,因为它是Web站点部署包的一部分).
然而,由于某种原因,MVC没有重写URL来为我的网站调用正确的处理程序.因此,在我在各种Stackoverflow文章和博客文章中进行更多讨论之后,当我终于在MSDN上遇到这个文章时,我有一个突破.它解释了如何使用IIS管理器的GUI将UrlRoutingModule显式添加到web.config,即使它显示为我的站点已安装:

取消选中"仅针对ASP.NET应用程序或托管处理程序的请求调用"复选框后,"条目类型"更改为" 本地"(请参见上面的屏幕截图),并在我的web.config中显示相应的部分.IIS突然开始理解<system.webServer>部分(我仍然不知道为什么),并且该网站开始渲染MVC视图.在cdonner上查看更多...
| 归档时间: |
|
| 查看次数: |
9509 次 |
| 最近记录: |