在Windows Server 2016 Std上运行使用VS2015编译的.NET / C ++代码 [英] Running .NET/C++ code compiled with VS2015 on Windows Server 2016 Std

查看:159
本文介绍了在Windows Server 2016 Std上运行使用VS2015编译的.NET / C ++代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以确认在Windows Server 2016 Std上运行使用Visual Studio 2015(32位.NET托管exe加载非托管C ++ dll)构建的Windows服务是否存在任何已知问题?


我已经在服务器上安装了2015的vc运行时。此下载的网页没有明确提到Windows Server 2016的兼容性。


我已经运行procmon并验证所有存在依赖关系的Dll都正确加载。


SCM报告服务启动超时等待目标进程响应的进程错误。我已经尝试将超时更改为更长的值(120秒),但这没有帮助。我的exe(托管代码)加载一个非托管的
C ++ dll,并使用一个使用C ++ dll函数创建的委托来响应SCM。


是否有其他人遇到过这个问题?任何建议都会有所帮助。

解决方案


感谢您在此发帖。


您是否构建了Windows服务应用程序? 我建议你可以调试你当前的项目。由于当前论坛只讨论了有关为Windows开发桌面应用程序的一般问题。我会将案例移到偏离主题的地方,
我希望答复对解决问题有帮助。


据我所知,有两种类型的服务你可以使用.NET Framework在Visual Studio中创建。作为流程中唯一服务的服务被分配类型

Win32OwnProcess
。与其他服务共享进程的服务将分配类型

Win32ShareProcess
。您可以通过查询
ServiceType
来检索服务类型。属性 


对于Windows服务应用程序,您无法立即运行服务或步入其代码。相反,您必须安装并启动服务,我认为您应该正确安装它,然后将调试程序附加到服务的进程中。
有关详细信息,请参阅
如何:调试Windows服务应用程序



注意:Visual Studio 2010中未包含C ++的Windows服务模板。要创建Windows服务,您可以创建服务在Visual C#或Visual Basic中的托管代码中,如果需要,可以与现有的C ++代码
互操作,或者您可以使用
ASPL项目向导


最好的问候,


Hart




Can anyone confirm if there are any known problems running a windows service built using Visual Studio 2015 (a 32-bit .NET managed exe that loads an unmanaged C++ dll) on Windows Server 2016 Std?

I have installed the vc runtime for 2015 on the server. The web-page for this download does not explicitly mention compatibility for windows server 2016.

I have already run procmon and verified that all Dlls, on which there are dependencies, are being loaded correctly.

The process errors out with the SCM reporting that the service startup timed out waiting for the target process to respond. I have tried changing the time-out to a longer value (120 seconds) but that does not help. My exe (managed code) loads an umanaged C++ dll and uses a delegate created using a function from the C++ dll to respond to the SCM.

Has anybody else faced this problem? Any suggestions would be helpful.

解决方案

Hi,

Thank you for posting here.

Did you build the windows service application?  I would suggest that you can debug your current project. Since the current forum just discuss  general issues about developing desktop applications for Windows. I will move the case to off-topic, I hope that the reply would be helpful for solving issue.

As far as I know that there are two types of services you can create in Visual Studio using the .NET Framework. Services that are the only service in a process are assigned the type Win32OwnProcess. Services that share a process with another service are assigned the type Win32ShareProcess. You can retrieve the service type by querying the ServiceType property. 

For windows service application, you cannot immediately run a service or step into its code. Instead, you must install and start your service, I think that you should install it correctly and then attach a debugger to the service's process. For more information, see How to: Debug Windows Service Applications.

Note: The Windows service template for C++ was not included in Visual Studio 2010. To create a Windows service, you can either create a service in managed code in Visual C# or Visual Basic, which could interoperate with existing C++ code if required, or you can create a Windows service in native C++ by using the ATL Project Wizard.

Best Regards,

Hart


这篇关于在Windows Server 2016 Std上运行使用VS2015编译的.NET / C ++代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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