Azure Service Fabric注册COM组件 [英] Azure Service Fabric register COM component

查看:94
本文介绍了Azure Service Fabric注册COM组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们希望将ASP.NET WebApi服务部署到Azure Service Fabric.
该服务使用数学COM组件(32位),该组件将使用regsvr32在常规计算机上注册. 该解决方案可以在本地Service Fabric群集上完美运行(例如Windows Server 2012 R2). 不幸的是,该组件没有可用的托管dll,我们也不想自己重写所有代码.

We want to deploy a ASP.NET WebApi service to Azure Service Fabric.
The service uses a mathematical COM component (32bit) that will be registered on a regular machine with regsvr32.

The solution works perfectly on a local Service Fabric cluster (e.g Windows Server 2012 R2). Unfortunately there is no managed dll available for that component and we do not want to rewrite the code all by ourselves.

所以我的问题是,我们可以将此服务部署到Azure托管的服务结构吗?
如果是的话,怎么办?

So my question is, can we deploy this service to an Azure hosted Service Fabric?
And if yes, how?

推荐答案

如何通过PInvoke在本地群集上调用它?有两个想法可以帮助您:

How are you calling it on the local cluster - through PInvoke? A couple of ideas to help:

您可以使用 COM互操作:

tlbimp YourComDll.dll /out: YourDotNetWrapper.dll

然后使用Service Fabric服务中的YourDotNetWrapper.dll.您可能可以摆脱COM组件的"xcopy"样式部署,即将其作为资源包含在您的项目中,然后将其复制到输出文件夹中,例如bin/Release.

Then use YourDotNetWrapper.dll from you Service Fabric service. You may be able to get away with "xcopy" style deployment of the COM component, i.e. include it as a resource in your project and have it copied to the output folder e.g. bin/Release.

如果仍然需要注册,则可以使用

If it still needs to be registered, you can register it in code with Process.Start("regsvr32...") or via code (PInvoke) - thought you may need to elevate privileges on Service Fabric.

您将需要一种仅注册一次的机制,以避免向注册表发送垃圾邮件.可能是Reliable Dictionary of [NodeName],[IsOurComRegistered],或者只是在注册之前检查它是否已注册.

You would need a mechanism to register it only once to avoid spamming the registry. Maybe a Reliable Dictionary of [NodeName],[IsOurComRegistered], or just checking if it is registered before registering.

祝你好运!

这篇关于Azure Service Fabric注册COM组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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