4

So I have two projects: a Web API service and MVC web site which consumes service, both in one solution. I considered to run them using multiple startup projects option, but encountered a problem. Since Web API has no web interface, it opens in browser and lists contents of project directory. How can I prevent this?

4
  • do you debug your web api project in visual studio or deploy it to IIS ? Commented Mar 29, 2015 at 19:03
  • Prevent.. what? You don't want to open a webpage for the web api? Why don't you just close it? Commented Mar 29, 2015 at 19:07
  • also consider this question stackoverflow.com/questions/5549374/… Commented Mar 29, 2015 at 19:08
  • You can add a default controller/action that returns an empty view or add a default.htm to the root of the Web API project. If you don't want the web page to display you could try running IISExpress from the command line iis.net/learn/extensions/using-iis-express/…. Commented Mar 29, 2015 at 19:09

1 Answer 1

5

If you don't want the browser window to open every time you run the project you can change your Web Api project properties.

Go to Properties > Web and select "Don't open a page. Wait for a request from an external application" under the 'Start Action' heading, this will keep the project running in the background.

See answer here: https://stackoverflow.com/a/716757

Sign up to request clarification or add additional context in comments.

1 Comment

Nice find.. Not all of us get a chance to read complete Visual Studio documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.