How can I programmatically run the ASP.Net Development Server using C#?

前端 未结 4 2042
傲寒
傲寒 2021-02-04 11:41

I have ASP.NET web pages for which I want to build automated tests (using WatiN & MBUnit). How do I start the ASP.Net Development Server from my code? I do not want to use I

4条回答
  •  遇见更好的自我
    2021-02-04 12:14

    From what I know, you can fire up the dev server from the command prompt with the following path/syntax:

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\Webdev.WebServer.exe /port:[PORT NUMBER] /path: [PATH TO ROOT]
    

    ...so I could imagine you could easily use Process.Start() to launch the particulars you need through some code.

    Naturally you'll want to adjust that version number to whatever is most recent/desired for you.

提交回复
热议问题