Reputation: 147
I am just getting started here and would appreciate some help.
I created a MVC 4 Web API project (VS 2012) and a MSTest project in a solution.
I wrote a test method in MSTest and use the WebClient class to call into the Web API project with a URL like:
http://localhost:59466/api/values
I was hoping this would cause the Web API project to run and call the sample Values controller that is put in as a default.
When I run the tests, I get a test error "Unable to connect to server".
So how do I get the Web API app running so my MSTest project can call in to it?
Upvotes: 0
Views: 889
Reputation: 1
The Web API project has to be started before running MStest. I end up having two windows of Visual Studio 2012 and they open the same solution. One is used to start Web API and the other can run/debug tests using MSTest.
Upvotes: 0
Reputation: 334
If i understood your question. Most likely the url you posted is from Visual Studio development server rather than IIS. If you deploy your site to IIS and try that i believe your problem would be solved.
If you don't host your site in IIS your MSTest project cannot call it unless your site in running in dubug mode in Visual Studio.
Upvotes: 1