[英]When debugging, is there any way to get Visual Studio to load DLLs for my Web API project without opening a browser window
I can make Visual Studio open my ASP.NET Web API in a new browser window, but that's annoying because I don't want a browser window to pop up. 我可以使Visual Studio在新的浏览器窗口中打开ASP.NET Web API,但这很烦人,因为我不想弹出浏览器窗口。 I want to go straight to Postman and start hitting endpoints.
我想直接去邮递员,并开始触碰端点。
Ideally I'd like to have Visual Studio try to run an endpoint (eg http://localhost:54292/token ) silently in the background, which will trigger the loading of most of the DLLs I need automatically. 理想情况下,我希望Visual Studio尝试在后台静默运行终结点(例如http:// localhost:54292 / token ),这将触发自动加载我需要的大多数DLL。
I know I can use the "start external program" feature and use something like cURL, but this opens a command window in the foreground, which is also annoying. 我知道我可以使用“启动外部程序”功能并使用类似cURL的功能,但这会在前台打开命令窗口,这也很烦人。
Is there any way to hide the command window, run my program minimized, or make it eager load DLLs when debugging? 有什么方法可以隐藏命令窗口,最小化运行我的程序,或使其在调试时急于加载DLL?
Choose the option "Don't open a page. Wait for a request from an external application", then use Postman after starting your debug session. 选择选项“不要打开页面。等待来自外部应用程序的请求”,然后在启动调试会话后使用Postman。
Alternatively, write a new windows form application and set that as the startup project. 或者,编写一个新的Windows窗体应用程序并将其设置为启动项目。 In that application, call the url you are interested in and remove the default form.
在该应用程序中,调用您感兴趣的URL并删除默认表单。 It will have no GUI.
它没有GUI。
You could also have the web application itself make a call into itself on startup by putting that code in your startup (globax.asax or startup.cs). 您也可以让Web应用程序本身在启动时对其进行调用,方法是将该代码放入启动中(globax.asax或startup.cs)。 You would probably want to remove this on deploy though, hence why I'd suggest a separate application.
您可能希望在部署时删除它,因此为什么我建议使用单独的应用程序。
please try below line of code if it helps you 如果有帮助,请尝试下面的代码行
var proc1 = new ProcessStartInfo();
proc1.FileName = @"cmd.exe";
proc1.Verb = "runas";
proc1.Arguments = "/c " + command;
proc1.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(proc1);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.