Problem running MVC3 under IIS 7.5 - asp.net-mvc-3

I am trying to make Visual Studio 2010 to run my project under a local instance of IIS 7.5 instead of starting the web development server. There is no problem deploying it to IIS, but when i try to browse to the site, it's like the routes never been registered in IIS because i get error "The Web server is configured to not list the contents of this directory." when i try to browse "http://localhost/returnjson", and when i browse "http://localhost/returnjson/Home/Index" i get error 404. And there is nothing wrong with the routes in my project, it works under web development server. What could be the problem?

It's hard to say what's wrong here but there are a couple of things you could try.
You could be looking at the wrong application. IIS comes pre-configured with a default application that acts as a catch all. Any unmapped domain name will end up there. So, by default when you visit localhost you'll end up there.
If you deployed your application into a new IIS site, make sure you bind it a proper domain name like myapp.local. Then add that domain name to your hosts file (%Windows%\System32\Drivers\etc\hosts) and map it to IP 127.0.0.1.
Another thing that could be wrong is that your IIS configuration is a bit screwed up. It happens sometimes. You can fix that with aspnet_regiis like so:
aspnet_regiis -ir
This tool is located under:
%Windir%\Microsoft.NET\Framework\v4.0.30319

Right click on your MVC3 project and select Publish. Publish it to the Filesystem and select a folder on your hard drive.
Navigate to your published folder and copy everything in it.
It's a pain in the keister but you can get through it.
Your folder in C:\inetpub\wwwroot should look like this after pasting your published application into the wwwroot:
Can you confirm that your folder looks like this?

You could also try out IIS Express in stead of IIS 7.5
IIS Express is a lightweight, self-contained version of IIS optimized for developers. IIS Express makes it easy to use the most current version of IIS to develop and test websites. It has all the core capabilities of IIS 7 as well as additional features designed to ease website development

Related

How do I deploy a .net core 1.1 app to IIS?

I right-clicked on the project and selected Publish. I chose Folder as the target and VS 2017 published it to that folder.
I want to copy the output to IIS so that I can host it. Which folder should IIS point to in the output?
The output contains a bunch of folders and I've tried to get IIS to point to some of them without any success. In addition, I am not seeing a default.htm or anything traditional like that.
So where should IIS point to?
You will need to copy whatever you see inside the screenshot under PublishOutput to a folder in web server. For example, C:\inetpub\wwwroot\yourapplication.
Then in IIS, Add Website or Add Application depending on your requirement.
In addition, you will need to install .NET Core Windows Server Hosting bundle on the web server.

How to debug ASP site without port number on VS 2012 Express

I'm trying to debug an ASP.NET 4.0 web site using Visual Studio Express 2012. I've configured the project settings to use the local IIS web server which was installed with VS. I need to use IIS so that urlrewritingnet will work.
I need to run the site locally without a port number. Currently it runs as http://localhost:4652/ which breaks some of the routines since they reference Request.Url.Host. This results in attempts to access resources using http://localhost/.
There is a lot of code to this site and it would be extremely easier and quicker (I think) to just configure my local debug to run on localhost instead of localhost:4652. Is there a way of doing this?
Since it's IIS Express installed with VS there is no configuration manager for IIS. When I click PROJECT -> mysite Properties and change the Project Url (under Use Local IIS Web Server) to http://localhost/ I get a warning that reads:
The local IIS Express URL http://localhost/ specified for Web project mysite has not been configured. To keep these settings you need to configure the virtual directory. Would you like to create the virtual directory now?
When I click on Yes, I get another dialog box saying:
Unable to create the virtual directory http://localhost/
Does anyone know if this should or should not work and if it can work, how do I do it?
You can go to "user/documents/iisexpress/config" then open applicationhost with notepad or other relevant editor then go find "bindings" then change the value of bindingInformation into "*:80:localhost". Done
Its really simple. You need to attach the IIS process to the visual studio and browse the website.
Below article guides to achieve this.
http://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS
Its always a good practice to do a unit test of web apps to local iis while developing.

Manually Assigning WCF Application in IIS

In a Visual Studio "WCF Service Application" project, on the properties->web page, if I select "Use Local IIS Web Server"->"create virtual directory"...it creates the IIS application successfully in the Default Web Site of a local IIS 7.5 install. So far so good.
However, I'd like to use a site other than the default web site. My attempts to host the service in a different web site aren't working. I tried:
Delete the application / virtual directory in IIS that Visual Studio successfully created.
Manually create a new IIS application, in the different web site, using the same settings that were present in the IIS application previously created by Visual Studio automatically.
Go to Visual Studio, project properties->web, and select the "visual studio development server". Save. This is just an "erase" step.
On the same properties page, I select "Use Local IIS Web Server" again and hit save (without pressing "Create Virtual Directory").
In that last step, I expect it to save. It doesn't. It pops up a message saying the virtual directory does not exist. But as I stated, it does exist because I had manually created it just prior.
My own guesses about this problem:
*. The non-default site I've made is somehow different from the default web site, in a way I've yet to determine.
*. Visual Studio is not designed to work with a virtual directory that is not in the default web site.
Any suggestions or clarifications?
I've activated IIS "failed request tracing," but no records are created for this issue.
What you want to do is look at your second site is IIS (the one you want the WCF service to run under) and look at the host name on new or if you go to manage web site -> advanced settings and look at what is after the the bindings. So it may show something like: http:*:80:localhost2 . localhost2 is what you need. It may be an IP Address too, not sure how you set it up.
So then in your WCF project properties in the Use Local IIS Server -> Project URL you put the host name of the site. So for example it may be something like: http://localhost2/yourservice.svc .

Visual Studio 2010 change from localhost to full computer name/domain

I am using Visual Studio 2010 and I would like change debugging environment from the localhost to my full computer name/domain. Does anyone have some step by step instructions on how to do this? (I would also like to set it up as the default for all new projects plus how to change it in existing projects). I am new to using visual studio and programming in general.
I found this post Visual Studio 2010 - Change localhost to custom domain in the forum but it wasn't clear to me on how to make the change. I went to the project properties web tab and attempted to set up local IIS Web server but got the following error:
"ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly."
I am not ever sure if that was the correct way of going about doing this. I just need my debug url address to go from:
"http://localhost:53674/Projectname.aspx"
to:
"http://computername.pag-domain.webname.org/Projectname.aspx"
Thanks!
For fixing the iis web server, I am not really sure what was done...our IT department worked on that. For setting up the local IIS webserver in visual studio I did the following: In the web project properties, under the web tab, I choose "Use Local IIS Web server, in the project URL, I put the full computer domain and told it to create a virtual directory.
Got it. Our IT came to the rescue — he fixed some issues with the ASP.NET not accessing 4.0 correctly. Then I set up the "Use Local IIS Web server" correctly and it worked like a charm.

Deploying IIS Settings with Web Deploy

If I look at the Package/Publish Settings of a web application in Visual Studio 2010, there is an option to "Include all IIS settings as configured in IIS Manager (used only for IIS Web projects)"
I am using IIS instead of the VS Dev Server to run my web application, but when I deploy the package that Web Deploy creates to a remote server, the IIS settings that get applied to my remote IIS application are at the least, unfamiliar, and at the worst, completely wrong.
For instance, my local IIS has 2 virtual directories (images, sounds). But when I deploy, it creates 4 completely different virtual directories (_controltemplates, _layouts, _vti_bin, _wpresources), and if I manually create the 2 correct vdirs on the remote server beforehand, Web Deploy will delete them. Where the heck did Web Deploy get those from? Web Deploy also mis-applied the correct authentication settings on the remote IIS application.
Since the "Include all IIS settings as configured in IIS Manager" setting doesn't seem to pick up the right settings, I ultimately want to be able to create some kind of configuration file that Web Deploy will use as part of its deploy package. Ideally something that I can check into source control. But I can't figure out from the documentation how to do this. I see something about parameterization and manifests, but I can't quite figure it out.
Here is another article to look at. See the note about IIS Configuration, not all settings will be inherited, check if Windows authentication is set to true on the default web site.
Package/Publish Web Tab, Project Properties
http://msdn.microsoft.com/en-us/library/dd410108.aspx

Resources