C#windows服务使用dll [英] C# windows service to use dll

查看:194
本文介绍了C#windows服务使用dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述







我在视觉上构建了一个应用程序工作室,编译成一个项目。有一个dll和其他文件

I built an application in visual studio, that compiles to a project. Having a dll and other files




我想要使用dll在C#windows服务中。

I want to consume the dll in a C# windows service .

我的示例代码:

公共部分类SSLService:ServiceBase

     {

       公共SSLService()

        {

            InitializeComponent();

        }


        protected override void OnStart(string [] args)

        {

        }


        protected override void OnStop()

        {

        }
    }

public partial class SSLService : ServiceBase
    {
        public SSLService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
        }

        protected override void OnStop()
        {
        }
    }

有人可以给我一个关于如何在我的C#windows服务中使用DLL的提示

Could someone give me a hint on how to use the DLL in my C# windows service







推荐答案

感谢您发布此处。

首先您应该知道需要从C#服务调用哪种类型的DLL。

The first thing you should know which type DLL need to be called from C# service.

如果DLL是ummanged dll,则需要使用互操作或包装知识,有关详细信息,请参阅以下文档。

If the DLL is ummanged dll, you need to use the interop or wrapped knowledge, for more information please see the following documents.

C#通过C ++ / CLI包装器间接调用本机DLL(CSCallNativeDl lWrapper) 

C# indirectly call native DLL via C++/CLI wrapper (CSCallNativeDllWrapper) 

平台调用教程  。

如果dll是托管dll,您可以参考以下步骤:

If the dll is managed dll, you can reference these steps:

如何:创建和使用C#DLL(C#编程指南) 

如果您遇到其他问题,请随时与我联系。

If you encounter other issue, please feel free to contact me.

最好的问候,

Hart

如果您的问题已经解决,请记得关闭您的主题通过将有用的帖子标记为对同样问题的其他人有帮助的答案。

If your issue has been resolved, please remember to close your thread by marking useful posts as answer that can be helpful for other person with same issue.


这篇关于C#windows服务使用dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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