我是MVC的新手,每当我尝试构建我的项目时,无论我在哪里开始构建,我都会遇到此错误。 不幸的是,这个错误用丹麦语描述,但这就是这句话:
Linje 43: public class _Page_Views_Shared__LoginPartial_cshtml : System.Web.Mvc.WebViewPage<VinylStore.Models.> {
它表示预期的标识符。这是路径:
C:\users\me\AppData\Local\Temp\Temporary ASP.NET Files\vs\d57ebae8\c8c8aa37\App_Web__loginpartial.cshtml.639c3968.jsmx0knu.0.cs
我不知道为什么会突然发生这种情况,可能是我犯了一个菜鸟错误,但是有谁知道如何解决这个问题?
感谢所有的想法!
我无法找到有关此错误的任何信息。
修改
对不起,这是完整的来源。可能对熟练的眼睛有帮助。
> Linje 1: #pragma checksum "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "518263DAA87E2345C68BEA90D9DE845CCF2C6D7A"
Linje 2: //------------------------------------------------------------------------------
Linje 3: // <auto-generated>
Linje 4: // Denne kode blev oprettet ved hjælp af et værktøj.
Linje 5: // Runtime-version:4.0.30319.42000
Linje 6: //
Linje 7: // Ændringer af denne fil kan resultere i ukorrekt funktion, og ændringerne mistes, hvis
Linje 8: // koden oprettes igen.
Linje 9: // </auto-generated>
Linje 10: //------------------------------------------------------------------------------
Linje 11:
Linje 12: namespace ASP {
Linje 13: using System;
Linje 14: using System.Collections.Generic;
Linje 15: using System.IO;
Linje 16: using System.Linq;
Linje 17: using System.Net;
Linje 18: using System.Web;
Linje 19: using System.Web.Helpers;
Linje 20: using System.Web.Security;
Linje 21: using System.Web.UI;
Linje 22: using System.Web.WebPages;
Linje 23: using System.Web.Mvc;
Linje 24: using System.Web.Mvc.Ajax;
Linje 25: using System.Web.Mvc.Html;
Linje 26: using System.Web.Optimization;
Linje 27: using System.Web.Routing;
Linje 28: using VinylStore;
Linje 29:
Linje 30: #line 1 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 31: using Microsoft.AspNet.Identity;
Linje 32:
Linje 33: #line default
Linje 34: #line hidden
Linje 35:
Linje 36: #line 2 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 37: using System.Security.Claims;
Linje 38:
Linje 39: #line default
Linje 40: #line hidden
Linje 41:
Linje 42:
Linje 43: public class _Page_Views_Shared__LoginPartial_cshtml : System.Web.Mvc.WebViewPage<VinylStore.Models.> {
Linje 44:
Linje 45: #line hidden
Linje 46:
Linje 47: public _Page_Views_Shared__LoginPartial_cshtml() {
Linje 48: }
Linje 49:
Linje 50: protected ASP.global_asax ApplicationInstance {
Linje 51: get {
Linje 52: return ((ASP.global_asax)(Context.ApplicationInstance));
Linje 53: }
Linje 54: }
Linje 55:
Linje 56: public override void Execute() {
Linje 57:
Linje 58: #line 5 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 59: if (Request.IsAuthenticated)
Linje 60: {
Linje 61: var identity = (ClaimsIdentity)User.Identity;
Linje 62: var name = identity.FindFirstValue(ClaimTypes.GivenName) ?? identity.GetUserName();
Linje 63:
Linje 64: using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
Linje 65: {
Linje 66:
Linje 67:
Linje 68: #line default
Linje 69: #line hidden
Linje 70: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 476, 23, false);
Linje 71:
Linje 72:
Linje 73: #line 12 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 74: Write(Html.AntiForgeryToken());
Linje 75:
Linje 76:
Linje 77: #line default
Linje 78: #line hidden
Linje 79: EndContext("~/Views/Shared/_LoginPartial.cshtml", 476, 23, false);
Linje 80:
Linje 81:
Linje 82: #line 12 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 83:
Linje 84:
Linje 85:
Linje 86:
Linje 87: #line default
Linje 88: #line hidden
Linje 89: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 503, 11, true);
Linje 90:
Linje 91: WriteLiteral(" <ul");
Linje 92:
Linje 93: EndContext("~/Views/Shared/_LoginPartial.cshtml", 503, 11, true);
Linje 94:
Linje 95: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 514, 36, true);
Linje 96:
Linje 97: WriteLiteral(" class=\"nav navbar-nav navbar-right\"");
Linje 98:
Linje 99: EndContext("~/Views/Shared/_LoginPartial.cshtml", 514, 36, true);
Linje 100:
Linje 101: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 550, 39, true);
Linje 102:
Linje 103: WriteLiteral(">\r\n <li>\r\n <a");
Linje 104:
Linje 105: EndContext("~/Views/Shared/_LoginPartial.cshtml", 550, 39, true);
Linje 106:
Linje 107: WriteAttribute("href", Tuple.Create(" href=\"", 589), Tuple.Create("\"", 632)
Linje 108:
Linje 109: #line 16 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 110: , Tuple.Create(Tuple.Create("", 596), Tuple.Create<System.Object, System.Int32>(Url.Action("Index", "ShoppingCart")
Linje 111:
Linje 112: #line default
Linje 113: #line hidden
Linje 114: , 596), false)
Linje 115: );
Linje 116:
Linje 117: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 633, 18, true);
Linje 118:
Linje 119: WriteLiteral(" id=\"btnMenuCart\"");
Linje 120:
Linje 121: EndContext("~/Views/Shared/_LoginPartial.cshtml", 633, 18, true);
Linje 122:
Linje 123: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 651, 14, true);
Linje 124:
Linje 125: WriteLiteral(" role=\"button\"");
Linje 126:
Linje 127: EndContext("~/Views/Shared/_LoginPartial.cshtml", 651, 14, true);
Linje 128:
Linje 129: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 665, 19, true);
Linje 130:
Linje 131: WriteLiteral(" class=\"btn btn-md\"");
Linje 132:
Linje 133: EndContext("~/Views/Shared/_LoginPartial.cshtml", 665, 19, true);
Linje 134:
Linje 135: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 684, 28, true);
Linje 136:
Linje 137: WriteLiteral(">\r\n <span");
Linje 138:
Linje 139: EndContext("~/Views/Shared/_LoginPartial.cshtml", 684, 28, true);
Linje 140:
Linje 141: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 712, 42, true);
Linje 142:
Linje 143: WriteLiteral(" class=\"glyphicon glyphicon-shopping-cart\"");
Linje 144:
Linje 145: EndContext("~/Views/Shared/_LoginPartial.cshtml", 712, 42, true);
Linje 146:
Linje 147: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 754, 19, true);
Linje 148:
Linje 149: WriteLiteral(" aria-hidden=\"true\"");
Linje 150:
Linje 151: EndContext("~/Views/Shared/_LoginPartial.cshtml", 754, 19, true);
Linje 152:
Linje 153: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 773, 90, true);
Linje 154:
Linje 155: WriteLiteral("></span> 0</a>\r\n </li>\r\n <li>\r\n " +
Linje 156: " <div");
Linje 157:
Linje 158: EndContext("~/Views/Shared/_LoginPartial.cshtml", 773, 90, true);
Linje 159:
Linje 160: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 863, 17, true);
Linje 161:
Linje 162: WriteLiteral(" class=\"dropdown\"");
Linje 163:
Linje 164: EndContext("~/Views/Shared/_LoginPartial.cshtml", 863, 17, true);
Linje 165:
Linje 166: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 880, 30, true);
Linje 167:
Linje 168: WriteLiteral(">\r\n <button");
Linje 169:
Linje 170: EndContext("~/Views/Shared/_LoginPartial.cshtml", 880, 30, true);
Linje 171:
Linje 172: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 910, 16, true);
Linje 173:
Linje 174: WriteLiteral(" id=\"btnProfile\"");
Linje 175:
Linje 176: EndContext("~/Views/Shared/_LoginPartial.cshtml", 910, 16, true);
Linje 177:
Linje 178: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 926, 28, true);
Linje 179:
Linje 180: WriteLiteral(" class=\"btn dropdown-toggle\"");
Linje 181:
Linje 182: EndContext("~/Views/Shared/_LoginPartial.cshtml", 926, 28, true);
Linje 183:
Linje 184: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 954, 14, true);
Linje 185:
Linje 186: WriteLiteral(" type=\"button\"");
Linje 187:
Linje 188: EndContext("~/Views/Shared/_LoginPartial.cshtml", 954, 14, true);
Linje 189:
Linje 190: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 968, 23, true);
Linje 191:
Linje 192: WriteLiteral(" data-toggle=\"dropdown\"");
Linje 193:
Linje 194: EndContext("~/Views/Shared/_LoginPartial.cshtml", 968, 23, true);
Linje 195:
Linje 196: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 991, 21, true);
Linje 197:
Linje 198: WriteLiteral(" aria-haspopup=\"true\"");
Linje 199:
Linje 200: EndContext("~/Views/Shared/_LoginPartial.cshtml", 991, 21, true);
Linje 201:
Linje 202: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1012, 21, true);
Linje 203:
Linje 204: WriteLiteral(" aria-expanded=\"true\"");
Linje 205:
Linje 206: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1012, 21, true);
Linje 207:
Linje 208: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1033, 3, true);
Linje 209:
Linje 210: WriteLiteral(">\r\n");
Linje 211:
Linje 212: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1033, 3, true);
Linje 213:
Linje 214: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1036, 24, true);
Linje 215:
Linje 216: WriteLiteral(" ");
Linje 217:
Linje 218: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1036, 24, true);
Linje 219:
Linje 220: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1061, 118, false);
Linje 221:
Linje 222:
Linje 223: #line 22 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 224: Write(Html.ActionLink("Hello " + name + "!", "Index", "Manage", routeValues: null, htmlAttributes: new { title = "Manage" }));
Linje 225:
Linje 226:
Linje 227: #line default
Linje 228: #line hidden
Linje 229: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1061, 118, false);
Linje 230:
Linje 231: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1179, 31, true);
Linje 232:
Linje 233: WriteLiteral("\r\n <span");
Linje 234:
Linje 235: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1179, 31, true);
Linje 236:
Linje 237: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1210, 14, true);
Linje 238:
Linje 239: WriteLiteral(" class=\"caret\"");
Linje 240:
Linje 241: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1210, 14, true);
Linje 242:
Linje 243: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1224, 64, true);
Linje 244:
Linje 245: WriteLiteral("></span>\r\n </button>\r\n <ul");
Linje 246:
Linje 247: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1224, 64, true);
Linje 248:
Linje 249: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1288, 22, true);
Linje 250:
Linje 251: WriteLiteral(" class=\"dropdown-menu\"");
Linje 252:
Linje 253: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1288, 22, true);
Linje 254:
Linje 255: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1310, 32, true);
Linje 256:
Linje 257: WriteLiteral(" aria-labelledby=\"dropdownMenu1\"");
Linje 258:
Linje 259: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1310, 32, true);
Linje 260:
Linje 261: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1342, 33, true);
Linje 262:
Linje 263: WriteLiteral(">\r\n <li><a");
Linje 264:
Linje 265: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1342, 33, true);
Linje 266:
Linje 267: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1375, 9, true);
Linje 268:
Linje 269: WriteLiteral(" href=\"#\"");
Linje 270:
Linje 271: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1375, 9, true);
Linje 272:
Linje 273: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1384, 52, true);
Linje 274:
Linje 275: WriteLiteral(">My Profile</a></li>\r\n <li><a");
Linje 276:
Linje 277: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1384, 52, true);
Linje 278:
Linje 279: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1436, 65, true);
Linje 280:
Linje 281: WriteLiteral(" href=\"javascript:document.getElementById(\'logoutForm\').submit()\"");
Linje 282:
Linje 283: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1436, 65, true);
Linje 284:
Linje 285: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1501, 86, true);
Linje 286:
Linje 287: WriteLiteral(">Log off</a></li>\r\n </ul>\r\n </div>\r\n " +
Linje 288: " ");
Linje 289:
Linje 290: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1501, 86, true);
Linje 291:
Linje 292: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1710, 37, true);
Linje 293:
Linje 294: WriteLiteral("\r\n </li>\r\n <li>");
Linje 295:
Linje 296: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1710, 37, true);
Linje 297:
Linje 298: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1830, 22, true);
Linje 299:
Linje 300: WriteLiteral("</li>\r\n </ul>\r\n");
Linje 301:
Linje 302: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1830, 22, true);
Linje 303:
Linje 304:
Linje 305: #line 34 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 306: }
Linje 307: }
Linje 308: else
Linje 309: {
Linje 310:
Linje 311:
Linje 312: #line default
Linje 313: #line hidden
Linje 314: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1871, 7, true);
Linje 315:
Linje 316: WriteLiteral(" <ul");
Linje 317:
Linje 318: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1871, 7, true);
Linje 319:
Linje 320: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1878, 36, true);
Linje 321:
Linje 322: WriteLiteral(" class=\"nav navbar-nav navbar-right\"");
Linje 323:
Linje 324: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1878, 36, true);
Linje 325:
Linje 326: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1914, 15, true);
Linje 327:
Linje 328: WriteLiteral(">\r\n <li>");
Linje 329:
Linje 330: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1914, 15, true);
Linje 331:
Linje 332: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 1930, 114, false);
Linje 333:
Linje 334:
Linje 335: #line 39 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 336: Write(Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" }));
Linje 337:
Linje 338:
Linje 339: #line default
Linje 340: #line hidden
Linje 341: EndContext("~/Views/Shared/_LoginPartial.cshtml", 1930, 114, false);
Linje 342:
Linje 343: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 2044, 19, true);
Linje 344:
Linje 345: WriteLiteral("</li>\r\n <li>");
Linje 346:
Linje 347: EndContext("~/Views/Shared/_LoginPartial.cshtml", 2044, 19, true);
Linje 348:
Linje 349: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 2064, 106, false);
Linje 350:
Linje 351:
Linje 352: #line 40 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 353: Write(Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }));
Linje 354:
Linje 355:
Linje 356: #line default
Linje 357: #line hidden
Linje 358: EndContext("~/Views/Shared/_LoginPartial.cshtml", 2064, 106, false);
Linje 359:
Linje 360: BeginContext("~/Views/Shared/_LoginPartial.cshtml", 2170, 18, true);
Linje 361:
Linje 362: WriteLiteral("</li>\r\n </ul>\r\n");
Linje 363:
Linje 364: EndContext("~/Views/Shared/_LoginPartial.cshtml", 2170, 18, true);
Linje 365:
Linje 366:
Linje 367: #line 42 "c:\users\spont\onedrive\dokumenter\visual studio 2015\Projects\VinylStore\VinylStore\Views\Shared\_LoginPartial.cshtml"
Linje 368: }
Linje 369:
Linje 370:
Linje 371: #line default
Linje 372: #line hidden
Linje 373: }
Linje 374: }
Linje 375: }
Linje 376:
答案 0 :(得分:1)
您已将不完整的模型名称传递给视图:
public class _Page_Views_Shared__LoginPartial_cshtml : System.Web.Mvc.WebViewPage<VinylStore.Models.> {
在这里,您在模型名称的末尾有一个点(我猜测VinylStore.Models
是一个命名空间)您需要在视图中指定模型本身的名称,如下所示:
@model VinylStore.Models.LoginModel
假设您有一个名为LoginModel
的模型。