无法解析符号'页面'

时间:2015-03-14 00:59:34

标签: c# razor owin nancy

在决定将所有内容移至Owin之后,我选择了NancyFx来处理我的路线,视图等...但是Nancy Razor看起来效果不好因为我有些奇怪像

这样的问题
  1. 无法解析符号'X'
  2. 无法解析部分'X'
  3. 这是一张展示视觉工作室内部情况的图片......

    enter image description here

    这是我的web.config文件

    <?xml version="1.0" encoding="utf-8"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <configSections>
        <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
          <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
          <section name="razor" type="Nancy.ViewEngines.Razor.RazorConfigurationSection, Nancy.ViewEngines.Razor" />
        </sectionGroup>
      </configSections>
      <!--
        For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
    
        The following attributes can be set on the <httpRuntime> tag.
          <system.Web>
            <httpRuntime targetFramework="4.5.1" />
          </system.Web>
      -->
      <system.web>
        <compilation debug="true" targetFramework="4.5.1">
    
          <buildProviders>
            <add extension=".cshtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyCSharpRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
            <add extension=".vbhtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyVisualBasicRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" />
          </buildProviders>
        </compilation>
        <httpRuntime targetFramework="4.5.1" />
      </system.web>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    
      <system.web.webPages.razor>
        <pages pageBaseType="Nancy.ViewEngines.Razor.NancyRazorViewBase">
          <namespaces>
            <add namespace="Rockariam.Core.Controllers"/>
            <add namespace="Rockariam.Core.Libraries"/>
            <add namespace="Rockariam.Core.Models"/>
            <add namespace="System"/>
            <add namespace="System.Linq"/>
          </namespaces>
        </pages>
      </system.web.webPages.razor>
    
      <appSettings>
        <add key="webPages:Enabled" value="false" />
      </appSettings>
    </configuration>
    

1 个答案:

答案 0 :(得分:0)

要设置Nancys Razor风味,您需要在app.config中使用Razor部分。 有关详细信息,请参阅https://github.com/NancyFx/Nancy/wiki/Razor-View-Engine