I just started working with web api rest services. A very nice template in visual studio made it very easy to start. I'd allready made a backend so all I had to do was to make the controllers, which was a piece of cake from the template.
The debugging in IIS express wasn't a problem neither, but when I came to the deployment in IIS I faced some problems.
My setup is, as follows:
- Windows 8 Professional
- Visual studio 2013
- IIS 8
And the test server runs
- Windows server 2008
- IIS 7
Debugging in IIS
When I pressed F5 to run and debug the service I had no problems. But I needed to know how to deploy the files. So I took properties on the project in VS and under "Web" it was possible to uncheck the "Use IIS Express" and Create Virtual Directory. And then the troubles started.
First I got a error 500.19 and I started from the bottom and pressed help, which was an error. Instead I found out, that I had to edit the "C:\Windows\System32\inetsrv\config\applicationHost.config" file.
I needed to set overrideModeDefault="Allow" for handlers.. And actually.. the page told me, if I started from the top instead.
This took care of the 500.19 error but then I got a 404 and found this link.
http://www.aheil.de/2012/11/05/fixing-asp-net-mvc-4-web-api-404/
So I installed
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
or actually I had to do it through "Programs and Features" - "Turn Windows features on or off"
This wasn't enough but when I put the following line in web.config - system.webServer section
I was up and running.. All I needed was an iisreset and a VS restart to be able to debug.
Deploying to IIS 7
Now I could copy
- bin
- Content
- Scripts
- Views
- Global.asax
- Web.config
to the server. Make an application in the IIS and run it... Of course I had to set the application pool to .NET 4.0
The only thing I am missing now, is an installation package for the customer.

Ingen kommentarer:
Send en kommentar