Manually Assigning WCF Application in IIS - visual-studio-2010

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 .

Related

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.

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.

Need to name websites on localhost running on different Ports

I have my development PC on Windows 7 for ASP.NET and running Visual Studio 2010 and IIS 7 (NOT using the development web server). I have created multiple websites on different ports on my PC. E.g. http://localhost:8080 points to Website A. But when I open the site in Visual Studio, the project name shows as http://localhost:8080, as follows.
I would like to change that name to http://WebsiteA or http://WebsiteA:8080. Some identification.
I edited hosts and added
127.0.0.1 WebsiteA
Ping works fine. Also browsing WebsiteA:8080 works fine. But when I try opening the site (http://websitea:8080) in Visual Studio, it says Web site does not have Frontpage server extensions installed.
Is there any way to at least rename what's shown in the project list in Visual studio. I just need an identification on each website. I have about a dozen project and more may be added.
Thanks
IIS in Windows 7 allows you to have named virtual hosts. You can use that to separate out your sites. Visual studio cooperates with the naming of the virtual hosts. You will need to configure your visual studio project to operate against IIS (for debugging and running) rather than the visual studio built in web server.
Managed to find a way. This is what I did. Went to IIS Management, Created a new Website - Give it a name WebsiteA, Choose the folder where the web is located and give it a Host Name - WebsiteA. Click OK
Then go to Application Pools. You'll see your Host name there. Change the ASP.Net version to 4.0 or whatever you want. Then add a hosts entry 127.0.0.1 WebsiteA.
Now you can add http://WebsiteA in Visual Studio.
Thanks for all the help guys

What is the Visual Studio's Web Deploy "Mark as an IIS Application on destination" mean?

when I'm trying to deploy to an IIS7 website using Web Deploy, one of the options is to Mark as an IIS Application on destination.
What does this mean when have it ticked on or off?
When setting this option your site becomes an Virtual Application as opposed to a Virtual Directory.
For the differences between the two see: http://blogs.msdn.com/b/wenlong/archive/2006/11/22/virtual-application-vs-virtual-directory.aspx
Here is the relevant text from Oded's reference....
6.If you are not deploying IIS settings, select the Mark as IIS application on destination check box.
This option is not shown if you are deploying IIS settings, because the Web project's IIS application status is one of the IIS settings that is deployed.
You typically select this check box when the Include all IIS settings as configured in IIS Manager check box on the Package/Publish Web tab of the project Properties page is cleared. There are very few scenarios in which you would not want to deploy a Web project as an IIS application on the destination Web server. For example, suppose that the project that you are deploying is not actually a Web application but only contains virtual directory content, such as images, XML files, and so forth. In that case, you might want to clear this check box so that the deployed project is not set up as an IIS application.
It causes the deployed project to be setup as an IIS application on the destination.
If you uncheck it, the project will not be setup as an IIS application.
See step 6 of Creating a Publish Profile on this MSDN article, in particular the last sentence.

Visual Studio 2010: Debug web app in root of IIS 7 Web

I'm trying to configure my mvc project, so that I can debug it from IIS7, but I need it to be configured for the root of the web application.
What I've done:
Added the support for the "II6 configuration and metadata support" to IIS7
Created a new site in IIS7 at localhost:5000 (default settings)
Set the property "Use Local Web Server" in the project properties to : http://localhost:5000
When I click save I get the following warning:
"The local IIS URL http://localhost:5000/ specified for Web project MVC 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 yes I get the message:
"Unable to create the virtual directory. http://localhost:5000/"
The above works fine when I set the url to point to a sub/virutal folder e.g. http://localhost:5000/mvc.
Any ideas?
The solution is when creating your IIS Site, the underlying folder needs to point to the asp.net project folder..
Soo easy if you know the solution :)
In my case, I hadn't added the required host header to the IIS config. After doing so, Visual Studio stopped complaining.
In IIS7 manager, right-click on the site, and select "edit bindings." Make sure that the URL you're entering in VS is listed, and that you can ping it from the command line (should respond from 127.0.0.1). If you can't ping it, add the url to your c:\windows\system32\drivers\etc\hosts file.

Resources