获得安全性异常SQLCE 4,代码优先CTP 5&共享主机 [英] Getting Security Exception SQLCE 4, Code First CTP 5 & Shared Hosting

查看:135
本文介绍了获得安全性异常SQLCE 4,代码优先CTP 5&共享主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试使用MVC3 Razor,SQLCE 4和Code First(从Nuget下载的最后两个)建立一个网页,因此它是EF Code First CTP5.

I've been trying to setup a webpage with MVC3 Razor, SQLCE 4 and Code First, the last two downloaded from Nuget, so it is EF Code First CTP5.

我遇到了很多麻烦,但是我设法通过遵循

I've had a lot of trouble, but I manage to move forward by following this answer

但是现在我收到此安全例外

However now I am getting this Security Exception

说明:The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

我认为它应该在没有完全信任的情况下工作,所以我不知道现在出了什么问题.

I thought it should work without full trust so I don't know what is wrong now.

我正在将GoDaddy共享主机与.Net 4和IIS7一起使用

I am using GoDaddy shared hosting with .Net 4 and IIS7

可能是什么问题?

除了设置自定义错误= false以能够看到异常之外,我没有修改过web.config,否则我拥有通过使用Nuget首先获取并配置SQLCE和代码而生成的webconfig

I haven't modified the web.config, except for setting custom errors = false to be able to see the exceptions, otherwise I have the webconfig that was generated by using Nuget to get and configure SQLCE and Code first

是这样的:

  <?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=152368
  -->
<configuration>
  <appSettings>
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <customErrors
   mode="Off"
   />
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <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>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SqlServerCe.4.0" />
      <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </DbProviderFactories>
  </system.data>
</configuration>

正如我在对该问题的第一条评论中所述,

推荐答案

嗯,这是Code First CTP5的错误,它使用完全信任而不是中等信任. 来源

Hmmm as I said in the first comment on the question, it is an error with Code First CTP5, which uses full trust instead of medium trust. Source

这篇关于获得安全性异常SQLCE 4,代码优先CTP 5&amp;共享主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆