我試圖部署UpdateContries SQL CRL的過程,它調用的Web Service,以下幫助發現這裏SQL服務器找不到序列化程序集
- http://www.elzaris.co.za/using-web-services-in-sql-server-clr-assemblies/
- http://msdn.microsoft.com/en-us/library/84b1se47.aspx
- footheory.com/ blogs/bennie/archive/2006/12/07/invoking-a-web-service-from-a-sqlclr-stored-procedure.aspx
因此basicall y我在Visual Studio 2010上有一個Visual C#SQL CLR數據庫項目,它有一個調用外部Web服務的簡單過程,該Web服務作爲Web引用添加。
我已將項目複製到包含SQL Server 2008數據庫的遠程服務器。
在項目屬性我已經設置了生成序列組裝爲「開」,設置數據庫權限等級的「外部」和我已經部署代碼激活。
另外,在項目中,我手動創建和刪除的序列化程序集如下:
PreDeployScript.sql
IF EXISTS (SELECT [name] FROM sys.assemblies WHERE [name] = N'ReportsWebServicesXML')
DROP ASSEMBLY [ReportsWebServicesXML];
GO
PostDeployScript.sql
CREATE ASSEMBLY [ReportsWebServicesXML]
FROM 'E:\Projects\Reports\ReportsWebServices\ReportsWebServices\bin\Debug\ReportsWebServices.XmlSerializers.dll'
WITH PERMISSION_SET = SAFE;
GO
項目構建部署成功,我可以看到個ReportsWebServices和ReportsWebServicesXML在Assembies文件夾下的Visual Studio 2010的服務器資源管理器,但是當我嘗試運行它仍然會返回以下錯誤的程序:
Msg 6522, Level 16, State 1, Procedure UpdateContries, Line 0
A .NET Framework error occurred during execution of user-defined routine or aggregate "UpdateContries":
System.InvalidOperationException: Cannot load dynamically generated serialization assembly. In some hosting environments assembly load functionality is restricted, consider using pre-generated serializer. Please see inner exception for more information. ---> System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.
System.IO.FileLoadException:
at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)
at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[]
...
System.InvalidOperationException:
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
at System.Web.Services.Protocols.SoapClientType..ctor(Type type)
at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor()
...
任何提示?
不希望是無益的,該錯誤信息是相當具體和谷歌搜索它提供了有關網頁點擊數服務和XML序列化,這似乎與您的情況有關。你是否已經閱讀了這些信息(甚至有一篇微軟知識庫文章),如果有的話,你嘗試過/學到了什麼?這可能有助於避免人們發佈已經嘗試過的建議。 – Pondlife 2012-02-28 15:20:33
是的,我忘了在開場留言中提及。我按照宗教的三個鏈接的指示,比審查我的步驟,並試圖找到教程後的評論暗示。我也直接通過錯誤消息進行了搜索,並且發現所有的幫助都指出序列化程序沒有部署在數據庫中,但正如我所說的那樣,它被部署了,因爲我可以在Assembly文件夾中看到它,兩者都使用VS2010服務器Explorer或SQL Server Management Studio。 – 2012-02-28 16:36:54