调试ASP MVC应用程序中使用的C ++ DLL [英] Debug a C++ DLL used in ASP MVC application

查看:143
本文介绍了调试ASP MVC应用程序中使用的C ++ DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP MVC5 Web应用程序项目的bin文件夹中有一个C ++ DLL. (由于无法添加引用,我已从原始C ++项目复制并粘贴了它)我能够调用DLL(使用的DLLImport)的某些功能.我在其中一个功能上有问题.只有当我能够进入C ++ DLL的代码时,才能解决此问题.我也有C ++项目的代码(使用Cmake构建). 从Web应用程序代码进行调试时,如何到达C ++代码.如果使用F11,我应该可以找到C ++代码.

I have a C++ DLL in bin folder of my ASP MVC5 web application project. (I have copied and pasted it from the original C++ project as I was unable to add a reference) I am able to call some of the functions of the DLL(used DLLImport). I have a problem in one of the functions. This can only be solved when I will be able to step into the code of the C++ DLL. I also have the code of the C++ project (built using Cmake). How do I reach the C++ code while debugging from my web application code. If I use F11 I should be able to reach the C++ code.

推荐答案

调试ASP MVC应用程序中使用的C ++ DLL

Debug a C++ DLL used in ASP MVC application

1)首先,请确保所引用的DLL在其文件夹中具有 PDB 文件或其他输出文件.

1) First, make sure that make sure that the DLL you are referring to has a PDB file or other output file in its folder.

您应该在VS IDE中打开c ++项目,然后确保以 Debug x64 模式构建它.如果是这样,请再次构建它.

You should open the c++ project in VS IDE and then make sure that you built it with Debug and x64 mode. If so, build it again.

然后在c#Web项目中,使用 DLLImport 引用输出Debug文件夹中的xxx.dll,该文件夹包含pdb和其他整个文件.

Then in c# web project, use DLLImport to reference the xxx.dll in the output Debug folder which exists pdb and other whole files.

2)其次,转到工具-> 选项-> 项目和解决方案- > Web项目-> 使用IIS Express的64位版本.

2) Second, go to Tools --> Options --> Projects and Solutions --> Web Projects --> Use the 64 bit version of IIS Express.

3)第三,如果您调试一个网络核心Web项目,请右键单击该项目-> 属性-> 调试->选中启用本机代码调试.

3) Third, if you debug a net core web project, please right-click on the project--> Properties-->Debug-->check Enable native Code Debugging.

如果您调试一个Net Framework Web项目,请右键单击该项目-> 属性-> Web ->选中本机代码.

If you debug a net framework web project, please right-click on the project--> Properties-->Web-->check Native Code.

4)第四步,然后关闭VS Instance,删除asp.net核心项目的 bin obj 文件夹,然后重新启动Web项目并再次测试.

4) Fourth, then close VS Instance, delete the bin and obj folder of the asp.net core project, then restart your web project and test again.

此外,您可以

In addition, you can check this document Debug C# and C++ in the same debugging session.

更新1

由于该错误,我认为您应该更改为将IIS设置为x64,因为您使用的是x64本机dll.右键单击您的项目-> Properties-> Web->将IIS bitness更改为x64.

Due to the error, I think you should change to set IIS to x64 since you use x64 native dll. Right-click on your project-->Properties--> Web-->change IIS bitness to x64.

这篇关于调试ASP MVC应用程序中使用的C ++ DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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