A .NET Framework error occurred during execution of user-defined routine or aggregate “ManagedCodeCallTest”:
System.UriFormatException: Invalid URI: The URI is empty.
System.UriFormatException:
at System.Uri.CreateThis(String uri,Boolean dontEscape,UriKind uriKind)
at System.Uri..ctor(String uriString)
at System.ComponentModel.Design.RuntimeLicenseContext.GetLocalPath(String fileName)
at System.ComponentModel.Design.RuntimeLicenseContext.GetSavedLicenseKey(Type type,Assembly resourceAssembly)
at System.ComponentModel.LicenseManager.LicenseInteropHelper.GetCurrentContextInfo(Int32& fDesignTime,IntPtr& bstrKey,RuntimeTypeHandle rth)
at ManagedCode.MyClass.ArielComponentCall()
有任何想法吗?我正在努力做甚么可能吗?我阅读了有关许可dll的内容,但信息非常模糊.
编辑:CLR代码,以防它有帮助:
[SqlProcedure] public static void ArielComponentCall() { Ariel.ApplicationClass application = new Ariel.ApplicationClass(); object arielDoc = application.OpenDocument(@"P:\Projects\COAT\Ariel1.run"); }
包含此类的项目具有对com对象的引用.
解决方法
SQL Server disallows the use of a type or member that has a
HostProtectionAttribute that specifies a HostProtectionResource value
of SharedState,Synchronization,MayLeakOnAbort,or
ExternalProcessMgmt. This prevents the assemblies from calling members
that enable sharing state,perform synchronization,might cause a
resource leak on termination,or affect the integrity of the SQL
Server process.
根据程序集的“访问”设置,SQL Server将抛出错误(当SAFE时),或者对阻止的方法(UNSAFE和EXTERNAL ACCESS)不执行任何操作.
不幸的是,System.ComponentModel.LicenseContext类具有SharedState主机保护属性,并且是不允许的代码的一部分.因此,在代码中的某个位置会调用LicenseManager中的方法,该方法将无声地执行任何操作.
无论哪种方式,在SQL Server进程中运行com组件都不是一个好主意,因为com组件中的崩溃将导致整个SQL Server崩溃.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。