"A local variable named 'Model' cannot be declared in this scope" 生产托管错误。代码有什么问题?

"A local variable named 'Model' cannot be declared in this scope" error on production hosting. What's wrong with the code?

以下 Razor 代码在使用 Visual Studio 调试时工作正常,但在生产服务器上,它显示 A local variable named 'Model' cannot be declared in this scope. 错误。

<li><b>@Html.LabelFor(Model=>Model.RegisteredName)</b>&nbsp;@Model.RegisteredName</li>

在本地系统上,我在 web.config 的 <system.codedom> 部分中添加以下行:

<compilers>
      <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" />
    </compilers> 

当我删除它时,它在从 Visual Studio 调试时显示相同的错误。

当我将这些行添加到生产服务器时,它向我显示此错误:

This program is blocked by group policy. For more information, contact your system administrator

尝试将 lambda 的变量从 Model 更改为 model。 像这样:

<li><b> @Html.LabelFor(model => Model.RegisteredName)</b>&nbsp; @Model.RegisteredName</li>