2014-02-18 2 views
0

그래서 저는 이것을 아무 소용이없는 것으로 파악하려고 노력했습니다. Servicestack 면도기 '모델'이이 컨텍스트에 존재하지 않습니다.

나는 추가 ServiceStack의 framwork과 면도기 엔진이 NuGet을 경쟁

VS 2013에서 비어있는 새 ASP.NET 웹 응용 프로그램을 만들었습니다.

[Route ("/ Logon")]이있는 Logons DTO 클래스와 함께 간단한 /Services/LogonSvc.cs 서비스가 추가되었습니다. NuGet 템플릿에 의해 생성으로

추가 간단한 /Views/Logon/Logons.cshtml

web.config 파일은 바로, 정확해야?

하지만 VS는 여전히 "이름 '모델'이 현재 상황에 존재하지 않는다고 말하고 있습니다." "레이아웃"과 동일합니다.

web.config 파일을 Views 폴더로 복사했습니다. 변경 없음.

<?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=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"  /> 
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /> 
     </sectionGroup> 
    </configSections> 
    <system.web> 
     <compilation debug="true" targetFramework="4.5"> 
      <assemblies> 
       <add assembly="System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
      </assemblies> 
      <buildProviders> 
       <add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" /> 
      </buildProviders> 
     </compilation> 
     <httpRuntime targetFramework="4.5" /> 
     <httpHandlers> 
      <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" /> 
     </httpHandlers> 
    </system.web> 
    <system.webServer> 
     <modules runAllManagedModulesForAllRequests="true" /> 
     <validation validateIntegratedModeConfiguration="false" /> 
     <handlers> 
      <add path="*" name="ServiceStack.Factory" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" preCondition="integratedMode" resourceType="Unspecified" allowPathInfo="true" /> 
     </handlers> 
    </system.webServer> 
    <appSettings> 
     <add key="webPages:Enabled" value="false" /> 
    </appSettings> 
    <system.web.webPages.razor> 
     <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
     <pages pageBaseType="ServiceStack.Razor.ViewPage"> 
      <namespaces> 
       <add namespace="ServiceStack" /> 
       <add namespace="ServiceStack.Html" /> 
       <add namespace="ServiceStack.Razor" /> 
       <add namespace="ServiceStack.Text" /> 
       <add namespace="ServiceStack.OrmLite" /> 
       <add namespace="Telestion.Web" /> 
       <add namespace="Telestion.Web.Dto"/> 
      </namespaces> 
     </pages> 
    </system.web.webPages.razor> 
</configuration> 

Logons.cshtml, "모델"과 "레이아웃"아래 구불 구불 한 선 :

@model Telestion.Web.Dto.LogonResponse 
@{ 
    Layout = null; 
} 

<!DOCTYPE html> 
<html> 
<head> 
    <meta name="viewport" content="width=device-width" /> 
    <title></title> 
</head> 
<body> 
    <div>  
    </div> 
</body> 
</html> 

어떤 아이디어?

답변

3

확실하지 않지만 문제가 해결 될 수 있습니다.
@inherits ServiceStack.Razor.ViewPage<Telestion.Web.Dto.LogonResponse>

:
@model Telestion.Web.Dto.LogonResponse
그런 다음 파일의 시작 부분에이 추가 : .cshtml에서

이 줄을 제거

관련 문제