IIS Express: localhost/App_1 instead of localhost/App - iis-7

I downloaded the Web application code from TFS 2010. The solution file consist of the Project and EndProject with Websiteproperties to settings with the applicatoin name as localhost/App.
So, when I opened the solution it creates a application on IIS as localhost/App
I downloaded the same application code from different branch (different version)it consist the same solution script and it created a new application on IIS as localhost/App1
Currently I am using only the second version, I removed the first application from my local, I removed all IIS application. When opening the second code base it still creating the application as localhost/App1 on IIS.
It is trying to overwrite the script in solution file as well.
I could not get the setting that is causing this.!!

Check the properties on the second project, as the 1st project had already reserved the IIS application name the second project will have added a 1 to the App Name. VS will have then updated the properties to reflect that another solution had reserved the app name.

Related

How to host asp.net webapi project with the current build on IIS

I want to host my ASP.Net Web api project on IIS for local development. I have an angular UI that wants to access this API. So for this reason I don't want to run my ASP.Net project all the time, if it were running on IIS would be better. I read many articles but none of them seemed to resolve my problem.
I know how to publish my project and then host the published version of the current build but what I don't want to do is having to do a publish every time I build just to test my code.
If I am not mistaken there is an option for deploying a new version of my project with every build. Again I don't want it to be production ready, I only need it for local development to test my API.
When I was using the publish > host currently published version on IIS the application was running.
When I was configuring IIS to point to the application folder where the solution is found as well (that is what I saw in an article about configuring IIS) I got: "HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
The solution is:
Go to IIS Manager in windows
On the left hand side of the panel, right-click -> add new website
Add a Site name that you like
Set up a Physical path, that should point to your project folder (so not where your solution is but where your ASP.Net project is)
Add a unique port that number that you make sure you are not currently using
Add a host name, and register it in the C:\Windows\System32\drivers\etc\hosts file with your local ip address

Debugging a solution with multiple projects

I am trying to debug a project I inherited. This basically consists of an ASP.NET website hosted in IIS (local IIS not express though), and a number of other projects for example a project containing the model, another project containing the Data Access, another project containing control classes etc.
I have added the ASP.NET IIS hosted website to my Visual Studio solution by Right Clicking Solution > Add > Add Existing Website ...
When I debug the website (by setting it as the startup project) from Visual Studio, it launches and works OK so for example I manage to connect to the Web Services hosted on another server, login etc etc.
However I am finding problems to hit the breakpoints on the other projects, such as XXX.Web.Model, which contains source code I need to debug.
What settings can I modify to hit the breakpoints? I tried attaching w3wp.exe but to no avail.
You might need to set multiple startup projects, and for each of the projects you want to debug set it to 'Start with debugging'. To do that on the solution node in Solution Explorer right click and choose Properties then in the dialog go to the Startup Project tab. As shown in the image below.
Docs are over at https://learn.microsoft.com/en-us/visualstudio/ide/how-to-set-multiple-startup-projects?view=vs-2017 .

Difficulty with Converting a WebSite to Web Application and Testing

This is not as straight forward as I had hoped.
I created a Web Site project on my development machine using the Visual Studio C# template for a WebSite Project. (Visual studio 2010 .net 4.0). The project name is C:\Nova5\WebSite3. It consists solely of:
the Bin subdirectory
Nova.svc file
web.config file
It has been tested to run correctly by:
Setting the website as the startup project, then
Run Debug-->Start Debugging
When tested, the NovaDataService information page is correctly displayed. It also correctly works when used through my client project.
I followed the recommended procedure described at
Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio to covert the Web Site to a Web Application.
I now have the following problems and/or difficulties:
If I use the recommended procedure for testing the web site:
-- File | Open | Web Site
-- Build Web Site -- Start Debugging
I get the Error: The type 'Nova5WCFServiceLibrary.NovaDataService', provided as the Service attribute value in the ServiceHost directive, or provided in
the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Since, I think, the WebSite does work, I skipped this error and moved on to the next part of the article. The next issue (?) is there is no App_Code file in the WebSite. Is this necessary? If it is necessary, how should I create it? Or do I need to create another WebSite project from its template just to have it?
I did not copy the Nova.svc nor the web.config from the WebSite to the Web Application as none of the references I read indicated to do so. Should I copy these files to the Web Application as well?
I now used the "Convert to Web Application" on the Web Application project and recompiled the solution. Everybody is happy. No errors reported. So how do I now test the Web Application project on my development machine (which also has the client application) ?
TIA

Can't start ANY ASP.NET projects

I've been trying to fix this for quite some time now, but I simply can't make any ASP.NET projects in Visual Studio Express 2012 for Web. I get this error when I start a new project:
Web application projects are currently configured to use IIS Express. To switch back to using the Visual Studio Development Server, change the development server option under the Projects and Solutions/Web Projects Category of the Options menu. Configured IIS Express failed with the following error:
Filename: redirect.config
Error: Cannot read Configuration file.
So I went on the internet to try and find others with the same error but I can't find a concrete solution to my problem. I find something similar for older versions, but it doesn't fix my problem. I do have the IIS Manager up under my Services (When you want to Manage Windows). I even made a virtual folder, but to no avail. Still doesn't work.
I want to use IIS
How do I fix this?
In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click Properties
In the Properties window, click the Web tab.
To choose the Visual Studio Development Server, under Servers, click Use Visual Studio Development Server.
To use a specific port number with the Visual Studio Development Server, select Specific port and enter the port number. By default, the Auto-assign Port option is selected, and the port number that has been assigned to your application appears
To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, l ocalhost/WebApplication1).
To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, loca lhost/WebApplication1).
To choose a custom Web server, select Use Custom Web Server. In the Server URL box, type the URL that Visual Studio should start when it runs the current project.
You may for example open you project file in notepad search for the string <useiisexpress>true</useiisexpress> replace it with the string <UseIIS>True</UseIIS> save and reload the project.
Make a copy of the project file first though.

How can i have two concurrent web apps running on VS2008/VSS8.0/ASP.NET/IIS for a trunk and branch version?

Applications I am using:
Visual Studio 2008 (C#/ASP.NET)
Visual Source Safe 8.0
IIS 5.1
I have two Web Apps both named the same but one is used for major releases and the other is for minor (trunk and branch). I am wondering if there is an option in Visual Studio that prevents it from creating an ASP.NET app in IIS using the web app's project name. Since both of them are named the same I have to go into IIS and change the path of the application so that it point to the major (or minor) folder when i go between the two.
What I would like to do is have something like this:
http://localhost/webapp_major
http://localhost/webapp_minor
but the web projects still have the same name. I know I can go into the properties of the each project file and have them point to different places but I think that breaks something when you want to merge between the two.
Any Ideas would be very appreciated.
Instead of having HTTP based projects in your visual studio solution, add them as file projects, where the website will be accessed as c:\inetput\wwwroot\major_version (for example) in visual studio (and not http://localhost). That way you can have any kind of setup you want in IIS and your projects won't conflict when you merge them.
Your web application project will let you name the Virtual Directory anything you want. VS2008 extends this by allowing you to set this on a per-user basis, so this information won't be saved in the project file, and therefore won't be propagated to source control.
You can manually create a new web application in IIS and let it point to your working directory. Visual Studio should honor these settings.

Resources