2014-04-30 46 views
1

我創建了ASP.NET MVC Empty項目並使用NuGet Install-Package PiranhaCMSMvc安裝了Piranha MVC。經理工作但我無法打開任何頁面。 This thread沒有幫助我Piranha MVC HTTP 404.0 - 未找到

,這裏是我的web配置

<?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> 
+0

您可以嘗試直接訪問頁面,即/ home/your-permalink以檢查默認的起始頁面路由是否有問題? –

+0

http:// localhost:43142 /'默認路由爲'HTTP 404.0 - 未找到http:// localhost:43142/page?permalink = start&piranha-culture = en-EN'和路由爲'http:// localhost :43142/home/start'說相同的HTTP HTTP 404.0 - 未找到http:// localhost:43142/page /?permalink = start&piranha-culture = en-EN – Aray

回答

1

如果沒有找到相應路由/頁,然後包括在模板項目中的控制器必須失去。確保您的Controllers文件夾中有PageController & PostController。

此外,控制器和RouteConfig包括C#,所以如果你使用VB,你將不得不將它們轉換爲它們的功能。

當你在VS中創建項目時,確保你選中了包含MVC的選項到你的項目中,否則你的項目將沒有Global.asax並且路由不會被配置!

希望這會有所幫助!

+0

我有這些東西和經理都很好 – Aray