Deploying ASP.NET Web API App to IIS 7 On Different Server - asp.net-mvc

I have been literally stuck for hours trying to deploy a Web API app to IIS. I can not believe there are no useful tutorials online anywhere that I can find. Here is my situation.
I have a VERY basic Web API app. It is using .NET Framework 4.0. It doesn't do anything I just want to see the home page at this point.
I am developing it in Visual Studio 2012 on my local machine. I can hit my localhost and see the home page, even post some data through Fiddler works great.
I publish the solution using Build->Publish to my local file system.
I then copy and paste everything in that directory to my web server (actually using a repository but for simplicity sake)
I created a brand new application pool in IIS. .NET 4.0 Integrated.
I placed the folder that contains my published code inside of the directory of my main website. The folder name is WebAPI.
I created a new website in IIS, attached to that new app pool I created.
I start the website, browse it on localhost and everything works perfectly.
I try to go to the website externally "website.com/WebAPI/api" and get a
403.14 - Forbidden The Web server is configured to not list the contents of this directory.
I'm sure I'm doing something wrong, I've never deployed an MVC app to IIS on another server. I'm able to deploy it just fine on my local machine through IIS too. What am I missing? Thanks!
Edit: Yes, my server has other .NET 4.0 apps running just fine.

http://localhost/api
http://website.com/WebAPI/api
Is this correct?
If so, looks like it could be a path problem.

Related

404 error on azure for Asp.Net Web Api Project

I have deployed exact same solution on two servers, one is my own server in my basement and the other one is Microsoft Azure. The project is developed using Asp.Net Web Api 2.
On my own windows server running IIS 8.5 it totally works. For test, you can simply browse this link in your browser and see the error message {"Message":"The requested resource does not support http method 'GET'."} which shows the API has been hit.1
But exact same project on my Azure domain here, you just get a message saying
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
Everything about these two deployments is the same (to the best of my knowledge) and I was wondering if there is any further steps necessary on Web Api app deployment in MS Azure which I am missing.
I finally found the answer to this issue. If there are multiple apps deployed as one single website so each app is located in its own subfolder, you have to go to the configuration section of your web app on Azure and create virtual directories for each of those sub folders.
Ah, my problem was probably a common one. I was using
rootconfig = System.Web.Configuration.WebconfigurationManager.OpenWebConfiguration(null);
and that was returning the root web because the parameter was null.
When I ran it local that worked fine, but after I deployed the root Config was NOT what I wanted and my code was failing.
Switched to direct access via
stringVal = WebconfigurationManager.AppSettings["Foobar"].ToString();
Nice. Plus less overhead.

How do you publish an ASP.net MVC application from Visual Studio 2013 to your local network?

I made a simple ASP.net MVC web application in Visual Studio 2013, and I want to deploy it so it can be accessed from the browser on other computers on my local network. I have tried right-clicking my project > Publish (not sure what settings to use, Web Deploy, Web deploy package, File system,
I published the website to my inetpub/wwwroot folder.
I managed to get IIS up an running, I've tried adding an application in the manager and editing the permissions to Everyone. I tried navigating to localhost/application_name but I was getting errors about not being configured to list the directory. I enabled directory browsing, but that just means it now shows a list of the files. How do I get it to actually run the app when I navigate to it in the browser?
Am I close?
Edit: currently trying this http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer (although this I think is a step or two ahead of where I am)
Also tried this: http://www.programmerfish.com/how-to-deploy-asp-net-web-application-on-the-network-in-windows-7/#.VGTLCvnF81L no luck so far
You can use IIS Express which comes with visual studio 2013. I've used this method to allow other members of the staff to access the website that is in my computer. Scott Hanselman has done a great post which I use every time when I want to expose a website hosted in local iis express to others in the same network.
http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
If you have any queries, let me know. Hope this helps
When I want to use IIS Express within Visual Studio for development, but allow local network users to see a version of my site, I tend to create a publish profile in VS that publishes to the local file system (e.g. C:\Publish\<yourwebsite>). Then from IIS Manager create a new website pointed to that same folder and it should be accessible to you via http://localhost and to network users via http://<your-pc-name> or http://<your-local-ip>.
You will need to add an exception to Windows Firewall to permit HTTP requests (i.e. port 80) through to your local machine, but if you have configured IIS correctly they should see the website.
It is possible to make IIS Express available to remote clients but that's not what it's designed for so really you're better off going down the IIS route since this will allow you to test the configuration as it would be on a live/production setting at the same time.
Check this, and old version of the same question. I'd bet you need to install IIS locally
Use Visual Studio web server in local network
You need to enable IIS on the host as IIS Express is not built with that in mind. Its for debugging purposes.
You've also not mentioned your binding configurations or your app pool settings.
Here is a comprehensive tutorial on how to publish your application using IIS IIS Video tutorial
You will need to ensure the binding that you specify is available across the network and that the connecting clients have permissions.
The issue was that ASP.net was not registered with IIS
Opened command prompt as administrator
Navigated to C:\Windows\Microsoft.NET\Framework64\v4.0.30319
Ran aspnet_regiis -iru
Now web app runs in IIS http://www.asp.net/web-forms/overview/deployment/configuring-server-environments-for-web-deployment/configuring-a-web-server-for-web-deploy-publishing-%28remote-agent%29

how publish and view mvc website basic steps

First time I am trying to publish an mvc website. So far I have published it to a local folder and using IIS I have made the folder a virtual folder. How do I run the website from my browser and how to start it with Account/LogOn?
Here is the link of Video tutorial release by ScottGu regarding MVC deployment and study hope this will help you
http://weblogs.asp.net/scottgu/archive/2011/05/15/great-free-video-training-on-asp-net-web-forms-and-asp-net-mvc.aspx
There are many articles and tutorials out there about deploying ASP.NET MVC applications. Once IIS is configured you simply point your browser to http://localhost/NameOfTheApp/Home/Index and you should be ready to go.
First which version is there on remote server. For your account logon i am assuming that you are using default membership provider. I normally include membership provider table in my database. If you are running on IIS 6.0 then you have to made some changes as mentioned by Haacked on his blog. While publishing make sure that mvc dll in made copy local and is there on your bin folder on remote site. First publish the site on local and if it is running properly upload it on remote server set the connectionstring as told by your hosting provider

Routing problem with particular controller name using ASP.NET MVC 1 in IIS 7

I have joined a team developing an ASP.NET MVC version 1 application. I run this app on my local machine using IIS version 7.5. My operating system is Windows Server 2008 R2 Enterprise Edition. I use Visual Studio 2008 SP1 for development.
One of the controllers in this app is called ReportsController. The route table entries for this controller use 'Reports' as the controller name part. The problem I have is that, using IIS 7.5 on my local machine, I simply cannot access any of the Reports action methods. If I try to access, say, '/Reports/Index' from Chrome or Firefox, I get a 401 Unauthorized response (as seen using Fiddler) and the browser displays its username/password entry dialog.
Please note the following:
All other non-Report pages in the application work correctly.
If I add a breakpoint to Application_BeginRequest, it is not hit when requesting a Reports page.
If I change the Reports routing entries in the route table registration code so that I have to access paths like '/Reportss/Index' (note the extra 's') then these Reports pages work correctly.
I have tried deleting then recreating my Web application in IIS.
The Reports pages work fine if I run the application using the Visual Studio 2008 development server (Cassini).
There is no directory called Reports in the application directory.
The Reports pages work correctly on our UAT environment, also under IIS 7.5.
I have reviewed my IIS setting several times, including comparing them with those on UAT, and I can't see a problem.
While I can use Cassini to access the Reports pages, I would really like to understand what is causing this issue.
If you have Reporting Services installed on your machine. try to create a new web site and use it. If you have SSRS installed on your machine it uses /reports for hosting reports.
I have had problems using the directory name 'Reports' at the root of a .net 2.0 website on IIS 7.5. It generates a 503 Error, indicating that there is an error at the system level before IIS tries to serve the page. I am not sure if reporting services is installed on my server. I just changed the directory name, all links and everything worked.
I have the exact same issue in my MVC Application with reporting services installed on the same server where code was deployed. I have changed the Reporting Manager URL in "SQL Server Reporting Services Configuration" which was hostName/Reports and assigned a new name i.e. SSRSReports so the virtual directory is now hostName/SSRSReports.
Now my application as well as SSRS Reports are working as expected.

Any tutorials about how to create an ASP.NET MVC 2 website and run it against Local IIS Web Server (not use Cassini)

does anyone have any good links/tutorials about how to create a simple ASP.NET MVC website, and have it run against a Local IIS7 Web Server, instead of the default Visual Studio Development Server (aka Cassini).
Yes, i tried google, but i fail at getting some good keywords, etc.
Cheers :)
Here are my steps:
In IIS, Sites -> Add Web Site...
Fill in the name, whatever you want.
Set the physical path where your app is located.
In the Host Name option, type for example local.test.com
Hit OK
Then I update the hosts file located in $windir$\System32\drivers\etc
Adding the line
127.0.0.1 local.test.com
Don´t forget changing in the application pool of the created website the framework version.
I´m sure there must be other ways, I just follow this steps every time I want to create a new site in my local IIS and it works.
Good luck!

Resources