2008-09-16 18 views
33

CLRストアドプロシージャを実行しようとすると、次のエラーが発生します。どんな助けも大歓迎です。FileLoadException/Msg 10314 CLRストアドプロシージャの実行中のエラー

Msg 10314, Level 16, State 11, Line 1 
An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error: 
System.IO.FileLoadException: Could not load file or assembly 'orders, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An error relating to security occurred. (Exception from HRESULT: 0x8013150A) 
System.IO.FileLoadException: 
    at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 
    at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 
    at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
    at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
    at System.Reflection.Assembly.Load(String assemblyString) 

答えて

0

アセンブリはファイルI/Oを実行しますか?その場合は、アセンブリのアクセス許可を与える必要があります。 SSMSで:

  1. プロパティ]を選択し、
  2. は、データベース
  3. 展開し、 "プログラマビリティ"
  4. は "アセンブリ" を展開するためにノードを展開
  5. あなたのアセンブリを右クリックし、 "データベース" を展開し
  6. [全般]ページで、[アクセス許可セット]を[外部アクセス]に変更します。
67

SQLコマンドを実行すると問題が解決されたように見えます。

USE database_name 
GO 

EXEC sp_changedbowner 'sa' 
ALTER DATABASE database_name SET TRUSTWORTHY ON 
+1

あなたはそれを固定データベース名 –

+2

sp_changedbownerををUSEを意味します! http://support.microsoft.com/kb/918040の詳細: –

+2

@JuniorMayhé私はそれを修正しました! –

8

すべてのCPU構成でプロジェクトをビルドします。私はこの問題を自分自身のプロジェクトをx86構成でコンパイルし、x64 SQLサーバーで実行しようとしました。

2

上記の提案がすべて適用され、失敗しました。 それから、私のソースコードを "Any CPU"オプションで再コンパイルして、うまくいきました!

このリンクは助け: SQL Server failed to load assembly with PERMISSION

0
ALTER AUTHORIZATION ON DATABASE::mydb TO sa; 
ALTER DATABASE [myDB] SET TRUSTWORTHY ON 
GO 
関連する問題