Это не сработает на производстве и в тестовой системе, но отлично работает в системе dev. Такое ощущение, что при развертывании что-то потеряно, но не жалуется на отсутствующий файл или ресурс.
Приведенный ниже код дает мне «Сообщение об ошибке компилятора: CS1003: синтаксическая ошибка, в строке 29 ожидается«> »:
public class _Page_Areas_SecurityGuard_Views_Dashboard_Index_cshtml : System.Web.Mvc.WebViewPage < SecurityGuard.ViewModels.DashboardViewModel() > {
Но в этом файле или в исходном файле нет несоответствующих скобок.
Все в Execute выглядит правильно извергнутым из указанного исходного файла.
#pragma checksum "C:\{path}\Areas\SecurityGuard\Views\Dashboard\Index.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "CB3D0E13D4917D76BCD475640DD7740F6F1AB1D5"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ASP {
using System;
....
public class _Page_Areas_SecurityGuard_Views_Dashboard_Index_cshtml : System.Web.Mvc.WebViewPage<SecurityGuard.ViewModels.DashboardViewModel()> {
#line hidden
public _Page_Areas_SecurityGuard_Views_Dashboard_Index_cshtml() {
}
protected ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}
public override void Execute() {
#line 2 "C:\{path}\Areas\SecurityGuard\Views\Dashboard\Index.cshtml"
ViewBag.Title = "Index";
Layout = "~/Areas/SecurityGuard/Views/Shared/_SecurityGuardLayoutPage.cshtml";
....
}
Исходный файл
@model SecurityGuard.ViewModels.DashboardViewModel
@{
ViewBag.Title = "Index";
Layout = "~/Areas/SecurityGuard/Views/Shared/_SecurityGuardLayoutPage.cshtml";
}
<h2>
Manage Users and Roles</h2>
<div class="fl w48pc mr20">
<fieldset>
<legend>Manage Users</legend>
<p>@Html.ActionLink("Manage Users", "Index", "Membership", new { area = "SecurityGuard" }, null)
| @Html.ActionLink("Create User", "CreateUser", "Membership", new { area = "SecurityGuard" }, null)</p>
<table>
<tr>
<td>
Total Users:
</td>
<td>@Model.TotalUserCount
</td>
</tr>
<tr>
<td>
Users Online:
</td>
<td>@Model.TotalUsersOnlineCount
</td>
</tr>
</table>
</fieldset>
</div>
<div class="fr w48pc">
<fieldset>
<legend>Manage Roles</legend>
<p>@Html.ActionLink("Manage Roles", "Index", "Role", new { area = "SecurityGuard" }, null)</p>
<table>
<tr>
<td>
Total Roles:
</td>
<td>@Model.TotalRolesCount
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
</table>
</fieldset>
</div>
Ссылочная модель
using System;
....
namespace SecurityGuard.ViewModels
{
public class DashboardViewModel
{
public string TotalUserCount { get; set; }
public string TotalUsersOnlineCount { get; set; }
public string TotalRolesCount { get; set; }
}
}