servicestack,intellisense,servicestack-razor,Razor,Visual Studio 2013,servicestack,Intellisense,Servicestack Razor" /> servicestack,intellisense,servicestack-razor,Razor,Visual Studio 2013,servicestack,Intellisense,Servicestack Razor" />

ServiceStack 4 Razor:Visual Studio 2013中没有intellisense,更新为2

ServiceStack 4 Razor:Visual Studio 2013中没有intellisense,更新为2,razor,visual-studio-2013,servicestack,intellisense,servicestack-razor,Razor,Visual Studio 2013,servicestack,Intellisense,Servicestack Razor,我正在运行一个Asp.Net主机(ServiceStack.Host.AspNet 4.0.30.0)-带有Razor的ServiceStack 4.0.30.0项目 .Net框架目标:4.5.1 该项目编译得很好,但使用Visual Studio 2013和更新2,我的Razor视图中没有任何intellisense 关于如何让intellisense在ServiceStack Razor视图中工作,有什么想法吗? 我的机器也安装了MVC4和MVC5 这里还有一份我的web.config &

我正在运行一个Asp.Net主机(ServiceStack.Host.AspNet 4.0.30.0)-带有Razor的ServiceStack 4.0.30.0项目

.Net框架目标:4.5.1

该项目编译得很好,但使用Visual Studio 2013和更新2,我的Razor视图中没有任何intellisense

关于如何让intellisense在ServiceStack Razor视图中工作,有什么想法吗? 我的机器也安装了MVC4和MVC5

这里还有一份我的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">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
    </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>
    <httpRuntime />
    <compilation targetFramework="4.5.1" debug="true">
    <buildProviders>
        <add extension=".cshtml" type="ServiceStack.Razor.CSharpRazorBuildProvider, ServiceStack.Razor" />
      </buildProviders></compilation>
    <pages controlRenderingCompatibilityVersion="4.0" />
  <httpHandlers>
      <add path="*" type="ServiceStack.HttpHandlerFactory, ServiceStack" verb="*" />
    </httpHandlers></system.web>
  <system.web.webPages.razor>
    <pages pageBaseType="ServiceStack.Razor.ViewPage">
      <namespaces>
        <add namespace="windows_consumer81_demo.Models" />
        <add namespace="windows_consumer81_demo.Models.Scenario" />
        <add namespace="windows_consumer81_demo.Localization" />
        <add namespace="System" />
        <add namespace="ServiceStack" />
        <add namespace="ServiceStack.Html" />
        <add namespace="ServiceStack.Razor" />
        <add namespace="ServiceStack.Text" />
        <add namespace="ServiceStack.OrmLite" />
        <add namespace="windows_consumer81_demo" />
      </namespaces>
    </pages>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc" />
  </system.web.webPages.razor>
  <appSettings>
    <add key="DebugMode" value="true" />
    <add key="unsupportedRedirect" value="unsupported.html" />
    <add key="vs:EnableBrowserLink" value="false" />
  <add key="webPages:Enabled" value="false" /></appSettings>
<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>
</configuration>


我想它的工作方式应该是您在
web.config
中添加的所有名称空间都应该具有IntelliSense:

<system.web.webPages.razor>
  <pages pageBaseType="ServiceStack.Razor.ViewPage">
    <namespaces>
    <add namespace="YourNameSpaceHere" />
    <add namespace="SomeServiceStackNameSpace" />
    . . .
如果您正在使用其他类,只需添加:

@using MyServer.ServiceInterface;
@using MyServer.ServiceModel;
我推荐的另一个技巧是大力键入
@Model
对象。就在顶部,在
@继承ViewPage之后添加:

@{
  Your.Class.Name TypedModel = Model; 
}

请随意将
TypedModel
重命名为更好的名称。

请尝试
@inherits ViewPage
而不是
@model HomeScenarioResponse
,不幸的是,这也不起作用。我仍然在Razor视图中看到intellisense错误。这是一台新机器吗?可能尝试安装我正在运行的Visual Studio 2013,但基于此MSDN链接()引用的文本,Visual Studio 2013中似乎不支持MVC 3:Visual Studio 2010 SP1仅支持MVC 2和MVC 3,Visual Studio 2012仅支持MVC 3和MVC 4,Visual Studio 2013仅支持MVC 4。有关如何自动从MVC 2升级到MCV 3的信息,请参阅ASP.NET MVC 3应用程序升级程序。有关如何手动从MVC 2升级到MVC 3的信息,请参阅将ASP.NET MVC 2项目升级到ASP.NET MVC 3工具更新。有关如何手动从MVC3升级到MVC4的信息,请参阅将ASP.NET MVC3项目升级到ASP.NET MVC4。
@using MyServer.ServiceInterface;
@using MyServer.ServiceModel;
@{
  Your.Class.Name TypedModel = Model; 
}