Azure Service Fabric register COM component

久未见 提交于 2019-12-12 01:42:04

问题


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.

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


回答1:


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

You could use COM Interop:

tlbimp YourComDll.dll /out: YourDotNetWrapper.dll

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.

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.

Good luck!




回答2:


You can try installing this COM with regsvr32 via StartUp and see if that would work.

Here are some notes on Startup Tasks.



来源:https://stackoverflow.com/questions/42400613/azure-service-fabric-register-com-component

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!