How to debug ASP site without port number on VS 2012 Express - visual-studio-2010

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.

Related

Prevent visual studio 2010 start a local IIS

I have a solution with many types of projects, and some of them are websites. Usually, I debug a non-website projects, but everytime I start to debug any project in the solution, the local visual studio IIS starts runnning.
Is there any possible way to stop running the IIS server ???
Thanks!
Open your project and go to the projects Properties. In web apps, you should see a Web tab/choice. Click that, then you can configure which/what server you want to start. I think that the default is that VStudio likes to use it's internal IIS Express, but you can configure it to use IIS locally on the box or to use a custom server.
You can actually set the project to not start anything in the Start Action section on that 'tab' as well, and to simply wait until it registers a connection.
Note that if you are trying to debug using a non-local server, then remote debugging will have to be on on the server, which isn't a great idea in production environments.

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.

Problem running MVC3 under IIS 7.5

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

Visual Studio: testing on different a server than developing on

In dreamweaver, it's really simple to set up a site so when you test a page that you are developing that it deploys it to a different test server that you are developing on and then browses to that page at that location also.
Question: Can you set up Visual Studio so that when you "run" or "View in Browser" that it automatically pushes the pages out to the test server and then browses to that location as well?
You've got two options as far as I can see:
1) Create a local project and set it up to run from your own local IIS, (this is not exactly what you're asking, but it should be more of an apples to apples test, as opposed to the built-in visual studio web server).
2) Use Remote Debugging to attach your Visual Studio instance to a remote server, links here and here
With option two, you'll still likely need to publish/deploy your solution to the server each time, but you will be able to step through and debug your code running on the remote server.
I think you can use an FTP project (File>Open Web Site and then select FTP) - as far as I'm aware, when you save a file it's automatically uploaded to the specified server. Then you could just point your browser at that web server.
I don't think this is possible,but you can always set up a shared folder where you put your code, and that shared folder is in fact the folder where your web server expect the code to be.

Resources