簡體   English   中英

ASP.NET MVC中的piranah-cms:無法預覽

[英]piranah-cms in ASP.NET MVC: Not able to preview

我正在嘗試將PiranahCMS設置到我的MVC應用程序中。 我能夠創建數據庫並訪問“管理員”(“經理”部分),在其中可以創建頁面等,如下所示: 在此處輸入圖片說明

嘗試發布頁面后,出現以下錯誤:

“ /”應用程序中的服務器錯誤。


[A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\harry\AppData\Local\Temp\Temporary ASP.NET Files\root\791319c4\b6685f9c\assembly\dl3\bdf36010\0d3a5a0e_b07ccf01\System.Web.WebPages.Razor.dll'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidCastException: [A]System.Web.WebPages.Razor.Configuration.HostSection cannot be cast to [B]System.Web.WebPages.Razor.Configuration.HostSection. Type A originates from 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.WebPages.Razor\v4.0_2.0.0.0__31bf3856ad364e35\System.Web.WebPages.Razor.dll'. Type B originates from 'System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Users\harry\AppData\Local\Temp\Temporary ASP.NET Files\root\791319c4\b6685f9c\assembly\dl3\bdf36010\0d3a5a0e_b07ccf01\System.Web.WebPages.Razor.dll'.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

我正在使用Visual Studio 2013,MVC 4和.NET 4.5。 Web.config如下:

已經用passiveMove =“ true”進行了測試

<settings>
      <managerNamespaces value="" />
      <disableManager value="false" />
      <passiveMode value="**false**" /> <!-- Have tested with  passiveMove="true" as well -->
      <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.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceAuthorization serviceAuthorizationManagerType="Piranha.Web.APIKeyAuthorization, Piranha" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel><connectionStrings>
    <!--    <add name="piranha-ce" connectionString="data source=|DataDirectory|Piranha.sdf" providerName="System.Data.SqlServerCe.4.0" />
        <add name="piranha-express" connectionString="data source=.\sqlexpress;initial catalog=piranha-db;user id=user;password=pass;multipleactiveresultsets=true;" providerName="System.Data.SqlClient" />
        <add name="piranha-local" connectionString="data source=(localdb)\v11.0;initial catalog=piranha-db;integrated security=true" providerName="System.Data.SqlClient" />
        -->
    <add name="piranha" connectionString="data source=VAIO;initial catalog=piranha-db;multipleactiveresultsets=true;Integrated Security=True;"   providerName="System.Data.SqlClient"  />
    </connectionStrings></configuration>

我在這里做什么錯?

如果需要其他任何信息,請告知我。

干杯

通過查看錯誤消息,我猜您已經使用了旨在用於ASP.NET MVC 5的Piranha CMS版本? 您安裝了哪個版本的Piranha CMS。 2.1.x版適用於MVC 4,而2.2.0版已升級到MVC5!

干杯

更新

我終於注意到您的評論之一出了問題。 您說您安裝了軟件包PiranhaCMS ,但是該軟件包用於ASP.NET WebPages。 對於MVC解決方案,正確的軟件包是PiranhaCMSMvc

希望這能解決您的問題!

問候

霍坎

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM