首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Piranha MVC HTTP 404.0 -未找到

Piranha MVC HTTP 404.0 -未找到
EN

Stack Overflow用户
提问于 2014-04-30 17:06:56
回答 1查看 416关注 0票数 1

我已经创建了Piranha MVC空项目,并使用NuGet Install-Package PiranhaCMSMvc安装了ASP.NET MVC。管理器可以工作,但我不能打开任何页面。This thread没有帮我

这是我的web配置

代码语言:javascript
复制
<?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>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <section name="piranha" type="Piranha.ConfigFile, Piranha" allowLocation="true" allowDefinition="Everywhere" />
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
    <authentication mode="Forms">
      <forms name="PiranhaCMS" timeout="30" />
    </authentication>
    <sessionState timeout="30" />
    <pages controlRenderingCompatibilityVersion="4.0" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <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="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <piranha>
    <settings>
      <managerNamespaces value="" />
      <disableManager value="false" />
      <passiveMode value="false" />
      <prefixlessPermalinks value="false" />
    </settings>
    <providers>
      <mediaProvider value="Piranha.IO.LocalMediaProvider, Piranha" />
      <mediaCacheProvider value="Piranha.IO.LocalMediaCacheProvider, Piranha" />
      <cacheProvider value="Piranha.Cache.WebCacheProvider, Piranha" />
      <logProvider value="Piranha.Log.LocalLogProvider, Piranha" />
    </providers>
  </piranha>
  <system.webServer>
    <modules>
      <remove name="UrlRoutingModule-4.0" />
      <add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
    </modules>
    <urlCompression doStaticCompression="true" />
  </system.webServer>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceAuthorization serviceAuthorizationManagerType="Piranha.Web.APIKeyAuthorization, Piranha" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel>
  <connectionStrings>
    <add name="piranha" connectionString="data source=myDbServer;initial catalog=EHRHome;user id=sa;password=*****;multipleactiveresultsets=true;" providerName="System.Data.SqlClient" />
  </connectionStrings>
</configuration>
EN

回答 1

Stack Overflow用户

发布于 2014-05-01 18:32:00

如果没有找到路由/page,那么模板项目中包含的控制器一定会丢失。确保控制器文件夹中存在PageController & PostController。

此外,包含的控制器和RouteConfig都是C#,所以如果你使用VB,你必须转换它们才能正常工作。

当您在VS中创建项目时,请确保选中将MVC包含到您的项目中的选项,否则您的项目将不会有Global.asax,路由也不会被配置!

希望这能有所帮助!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23384002

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档