Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've build Web Api and inside the project included a web site built with AngularJS. When I start the project it points to my web site and opens it. In AngularJS controllers I call methods from the web api for example http:/localhost:52004/api/reviews and on the same port I start the web site. After some time web api stopped working and didn't respond any result. The structure of the project is shown in advance.

Any help how can I call methods from web api local in my projects and why it doesn't start when I start my project?

enter image description here

share|improve this question
add comment

2 Answers

It's pretty hard to tell for sure without seeing all your code, but I would do the following:

  1. Create a fresh project with web-api and make sure this works without crashing, by hitting one of the services either from your browser, or a tool like fiddler
  2. Double check that the port is not being used by any other app
  3. Add a global exception handler that outputs to the debug console to see if your site is crashing anywhere
share|improve this answer
    
The point is the web api and the web site to run on same port :) –  Александар Михајловски Jun 24 at 12:08
    
But did you implement the Web APi and the web site in the same project, or in separate projects? If you did the second, it will not work. You cannot share a port between different applications (unless it's another ip, or header, of course) –  JotaBe Jun 24 at 12:09
1  
You can definitely run an ASP.NET website and Web API on the same ports. That will not be a problem. –  Daniel Mackay Jun 24 at 12:17
add comment

Mmmm.. do you have your web api project configured to return JSON? By default web api will return XML even if you enable JSON on some browsers you will get an XML result.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.