安装tinymce.mv​​c.jquery后,我的应用程序开始抛出System.MethodAccessException

时间:2014-01-31 01:19:59

标签: c# asp.net-mvc asp.net-mvc-4

我正在工作的asp.net mvc 4应用程序并且在我安装了 Tinymce.Mvc.Jquery 后响应正常。这是一个例外及其堆栈跟踪

  

尝试安全透明方法   'System.Web.WebPages.WebPageRoute。< .cctor> b__0()'访问安全性   批判方法   'System.Web.WebPages.Deployment.WebPagesDeployment.IsExplicitlyDisabled(System.String)'   失败

[MethodAccessException: Attempt by security transparent method 'System.Web.WebPages.WebPageRoute.<.cctor>b__0()' to access security critical method 'System.Web.WebPages.Deployment.WebPagesDeployment.IsExplicitlyDisabled(System.String)' failed.]
   System.Web.WebPages.WebPageRoute.<.cctor>b__0() +32
   System.Lazy`1.CreateValue() +319
   System.Lazy`1.LazyInitValue() +126
   System.Lazy`1.get_Value() +53
   System.Web.WebPages.WebPageRoute.get_IsExplicitlyDisabled() +79
   System.Web.WebPages.WebPageRoute.DoPostResolveRequestCache(HttpContextBase context) +98
   System.Web.WebPages.WebPageHttpModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) +157
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +136
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69 

这是我的配置文件

<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="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
      <section name="resizer" type="ImageResizer.ResizerSection" requirePermission="false" />

      <!--Note: I added this configuration. It was gotten from the nop commerce source code. -->
      <section name="BestConfig" type="Best.Core.Configuration.BestConfig, Best.Core" requirePermission="false" />
    </configSections>

    <!--Note: I added this configuration. It was gotten from the nop commerce source code. -->
    <BestConfig>
        <DynamicDiscovery Enabled="true" />
        <Startup IgnoreStartupTasks="true" />
        <Engine Type="" />
        <Themes basePath="~/Content/" />
    </BestConfig>

     <connectionStrings>
        <add name="BestDataContext" connectionString="Data Source=CIZA-PC\SQLEXPRESS;Initial Catalog=BestDb;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
        <!-- <add name="BestDb" connectionString="Data Source=CIZA-PC\SQLEXPRESS;Initial Catalog=SteekerDb;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> -->
    </connectionStrings>

    <appSettings>
    <add key="webpages:Version" value="2.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="PreserveLoginUrl" value="true" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  <add key="MvcMailer.BaseURL" value="" />
    </appSettings>
  <system.web>
    <httpRuntime targetFramework="4.5" />
    <compilation debug="true" targetFramework="4.5" />

      <membership defaultProvider="SimpleMembershipProvider">
          <providers>
              <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData" />
          </providers>
      </membership>

      <roleManager enabled="true" defaultProvider="SimpleRoleProvider">
          <providers>
              <add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider, WebMatrix.WebData" />
          </providers>
      </roleManager>


      <authentication mode="Forms">
          <forms loginUrl="~/Account/Login" timeout="2880" />
      </authentication>

    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
    <httpHandlers>
      <add verb="*" path="routes.axd" type="AttributeRouting.Web.Logging.LogRoutesHandler, AttributeRouting.Web" />
    <add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" /></httpHandlers>
  <!-- Glimpse: This can be commented in to add additional data to the Trace tab when using WebForms
        <trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false"/> --><httpModules>
            <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" />
        <add name="ImageResizingModule" type="ImageResizer.InterceptModule" /></httpModules></system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
      <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
      <remove name="ExtensionlessUrlHandler-Integrated-4.0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
      <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
      <add name="AttributeRouting" path="routes.axd" verb="*" type="AttributeRouting.Web.Logging.LogRoutesHandler, AttributeRouting.Web" />
    <add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" /></handlers>
  <modules>
            <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
        <add name="ImageResizingModule" type="ImageResizer.InterceptModule" /></modules></system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Deployment" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.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>
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
      <!-- If you are having issues with Glimpse, please include this. It will help us figure out whats going on. 
      <logging level="Trace" />-->

      <!-- Want to use Glimpse on a remote server? Ignore the LocalPolicy by removing this comment.
      <runtimePolicies>
        <ignoredTypes>
          <add type="Glimpse.AspNet.Policy.LocalPolicy, Glimpse.AspNet"/>
        </ignoredTypes>
      </runtimePolicies>-->
    </glimpse><resizer>
    <plugins>
    <add name="DiskCache" />
    <add name="MvcRoutingShim" />
    </plugins>
    </resizer>
    <system.net>


        <mailSettings>
            <!-- Method#1: Configure smtp server credentials 
            <smtp from="Steekerz@gmail.com">
                <network enableSsl="true" host="smtp.gmail.com" port="587" userName="some-email@gmail.com" password="valid-password" />
            </smtp> -->

            <!-- Method#2: Dump emails to a local directory -->
            <!---->
            <smtp from="Steekerz@gmail.com" deliveryMethod="SpecifiedPickupDirectory">
                <network host="localhost" />
                <specifiedPickupDirectory pickupDirectoryLocation="C:\Users\CIZA\Documents\Emails" />
            </smtp>

        </mailSettings>
        <defaultProxy enabled="true" />
        <settings>
            <!-- This setting causes .NET to check certificate revocation lists (CRL) 
                 before trusting HTTPS certificates.  But this setting tends to not 
                 be allowed in shared hosting environments. -->
            <!--<servicePointManager checkCertificateRevocationList="true"/>-->
        </settings>
    </system.net>
</configuration>

请对此提出任何帮助将不胜感激,因为它导致我失眠,因为项目已经迟到了。感谢

1 个答案:

答案 0 :(得分:1)

在Web.config的程序集绑定重定向部分中,您将System.Web.WebPages v2与一堆其他相关程序集(System.Web.Razor,System.Web.WebPages.Deployment)v3混合。确保这些都是统一的。

编辑:最简单的操作可能是将项目升级到MVC 5.这将在整个项目中统一System.Web.WebPages v3,然后你可以引入像tinymce.mv​​c.jquery这样的组件,其中包含v3的依赖关系。