0

I have created a web service in Visual Studio 2015 (web api) that listens out for requests via a barcode scanner. The barcode scanner links to a database that provides information such as stock quantities etc, but this is just for background information. The web service is currently installed on my local machine and works perfectly, returning the correct values and posts data to a database.

I attempted to install the web service onto a server, copying over similar settings in IIS (only have basic knowledge using this), such as the bindings and ensuring the permissions were set up correctly. However when running the web service I recieved a "404 not found error and 401 unauthorized". After that, I installed Visual Studio 2015 onto the server to ensure it wasn't a build or publish error...same problem.

Below are some of the 'fixes' I have tried to help narrow down the potential problem.

  1. Ensured the correct version of .Net, 4.0, is installed on the server.
  2. IIS Manager - Authentication: Annoymous Authentication set to enabled.
  3. IIS Manager - Directly browsing: set to enabled.
  4. Set the correct permissions using 'Edit Permissions', granted full control to 'Everyone'

This is my first time creating a web service so up until now I have been using tutorials and making it up as I go along. I think it could be to do with the application pools set up? But because the solution works on my local machine and not the server has me extremely confused. Thanks in advance.

Kara
  • 6,115
  • 16
  • 50
  • 57
  • Do you get these errors if you type a valid url directly into the browser on the server? In IIS you can right click on a file in your deployment and press 'browse' (I think that's it). Do you get a 404 or 401 error? If you don't get an error, take careful note of the URL that IIS gives you when you browse. – Nick.Mc Nov 04 '15 at 09:47
  • Nick, I would select the site from the 'Sites' list in IIS, and along the right hand side 'Browse Web Site'. On my machine, this brings up a simple homepage that lets me know the web service has opened correctly and I'd then use 'POSTMAN' (google chrome add-on) to send a request to see if the response is 'connected'. However, when I use 'Browse Web Site' on the server, this is where I see the 404 error. It might be important to mention that in debug mode, it works perfectly, but then thats probably because its using IIS express rather than IIS 7. – user2157181 Nov 04 '15 at 10:53
  • OK so this verifies that when you use the _correct_ URL you get a 404 error. (Before now I could not be certain that it was the correct URL). Next step is use this guide to work out the subcode: http://blogs.iis.net/tomkmvp/troubleshooting-a-404 so it'll be a 404.1 or something... work that out – Nick.Mc Nov 04 '15 at 11:59
  • My mistake, the error code is 403, but I have had a 404 error before, seems to be above my head. But the codes are below: The code is 403 14 0 7 There is also another code above thats 403 14 0 386 – user2157181 Nov 04 '15 at 14:32
  • There is also another code above thats 403 14 0 386 – user2157181 Nov 04 '15 at 14:33
  • Here's a similar issue:http://stackoverflow.com/questions/15323190/http-error-403-14-forbidden-iis-error-for-asp-net-mvc-4-application. If that doesn't work, can you post the URL (with server names and paths etc. hidden if you wish)? The error implies you are browsing the folder, and IIS is not set up to pick a default document or list the contents of the folder. – Nick.Mc Nov 04 '15 at 22:14
  • and this one... http://stackoverflow.com/questions/2374957/asp-net-mvc-on-iis-7-5... sounds like ASP.Net is not registered in IIS so when you hit the root folder it doesn't know what to do. When you install ASP.Net it will know to go to the correct document – Nick.Mc Nov 04 '15 at 22:17
  • Ah excellent, thank you!!!! – user2157181 Nov 06 '15 at 13:16
  • If that worked, I'll post as an answer – Nick.Mc Nov 07 '15 at 08:08

0 Answers0