Running aspnet web site starts on parent directory - asp.net

I have some old project written in asp.net web pages. I open project by Open Website option and choosing MyCompany folder. I start a project with debugging. The Asp.NET Development server starts.
Actual: localhost:53669/MyCompany/somepage.aspx
Expected: localhost:53669/somepage.aspx
How can I force the ASP.NET development server to start on MyCompany folder location not on the parent folder location?

What version of Visual Studio are you using? In Visual Studio 2010, you can change it in the project properties
Steps
Open the Solution Explorer
Right click your project
Click Properties Window (not Property Pages)
Alter the Virtual path option from /MyCompany to just /
Example so you know you're in the right place
Before
After

Related

Convert to Web Application in VS 2015.1

I'm running Visual Studio 2015 Enterprise Update 1.
I created an empty Visual Basic ASP.NET Website targeting the .NET Framework 4.5.2. And I want to convert it to an ASP.NET Web Application.
Under the Website's context menu in Solution Explorer there is no "Convert to Web Application" menu-item, nor is there anything under the Website menu in the main-menu bar:
Where has the feature gone? Has it been removed completely in Update 1?
This is the most confusing part of converting websites to web applications. The way you need to do it is to:
Create a new Web Application project
Copy all of your website contents into it (you could create the *.csproj file in the same website directory, then include all files into the project without actually having to move them)
The command will be available on the WebApp project (under the Project menu, at the bottom)
Basically at that point the command looks at the contents of the WebApp project and makes adjustments so that they are more suitable for a WebApp project.

How do you allow parent paths in Visual Studio 2013?

I am converting a classic ASP site to a Visual Studio 2013 MVC project. When I run the classic ASP code inside of the Visual Studio 2013 debugger I get an error message:
Active Server Pages error 'ASP 0131'
Disallowed Parent Path
The question is: how can I enable parent paths in the VS2013 debugger?
FYI - This is not IISExpress and enabling parent paths is different.
I discovered the answer myself. Here is how I did it.
I opened Task Manager and saw that Visual Studio was running
processes of IISExpress for the web server functionality.
I clicked on Start and entered IISExpress to find out where it was installed. To my surprise, but an obvious choice, it was located in documents.
I opened the C:\Users\Mike\Documents\IISExpress\config folder then
opened Notepad as an administrator.
I then opened the applicationhost.config file and under the <system.webServer> element there is an <asp> element. I modified it to read. <asp scriptErrorSentToBrowser="true" enableParentPaths="true">
I then opened by MVC solution and ran the Classic ASP program without any
problems. Everything works!
I have Visual Studio 2015 and I had to do something else.
Right-click on the IIS Express icon in your tray while the application is running, and select Show All Applications.
Click on the application you want to manage. You'll see the location of the IIS Express server config file in the details section below.
Edit it as administrator and add enableParentPaths="true" to the asp XML element (under system.webServer), as in the Mike G's answer.
For me, the config file was located in SolutionDir\.vs\config\applicationhost.config.

Debugging Visual Studio Website /w Nested Virtual Folder

I have an ASP.net website project mapped to my "Default Web Site" in IIS7. Within this site in IIS there is a /forum folder which was "Converted to Application".
I want to be able to debug/run the website in Visual Studio 2013, but when I build the website I get the following error:
Error 102 It is an error to use a section registered as
allowDefinition='MachineToApplication' beyond application level. This
error can be caused by a virtual directory not being configured as an
application in IIS. C:\inetpub\wwwroot\forum\web.config 22
Is there a way I can open (and debug/run) both the website and /forum application (also a website) in two instance of Visual Studio?
The problem is that you cannot "Exclude from project" a folder through Visual Studio; you can exclude a file or a project, but not a folder. If you run the website which contains a folder marked as an "Application" in IIS, you will always get a build error because of the full-blown web.config in the application folder. Visual Studio does not know that the folder is its own application.
The only solution is to navigate to the application folder you want to exclude from the project (using Windows Explorer), right-click on the folder and select 'Properties'. Finally, mark the folder as 'Hidden' and apply to all sub-folders.
Now, return to your project in Visual Studio and refresh the files in the Solution Explorer. The folder you hid should disappear and you can run & debug the website without any errors.

Debug ASP.NET web forms in full IIS

I'm running Visual Studio 2013 Ultimate on a Windows 8.1 (with Update 1) laptop, and I would like to debug an ASP.NET web forms project against IIS, which is installed on the local Windows 8.1 instance.
Previous versions of Visual Studio had an option to use IIS Express or full IIS, but I cannot find that option in the Project properties anymore.
How do I deploy & debug my ASP.NET web forms project in full IIS?
EDIT: When I right-click on my project, I see this:
And then if I click on "Properties Window" I see this:
This is one way to have your project available in IIS:
Press Ctrl+X, type inetmgr
or
Open your IIS Manager Application.
Expand the tree on the left.
Add WebSite
Give a name to the website and port
For file location provide the same file location were your project is.
Assuming your port number is 3000 just simply type http://localhost:3000 in your browser.
Now from Visual Studio go to:
file Open...
WebSite (you will see that IIS is available on the left).
Open your new web site
This will let you debug from IIS and any changes you make will be directly made on IIS as well.
I just double checked one of my local Web Forms applications locally running in Visual Studio 2013 Ultimate on Windows 8.1. The settings are still there. If you open the project properties for your Web Forms project, you should see the following:
After selecting Local IIS, setting a port, and saving, you should be walked through the process of configuring a Virtual Directory for your site (if one isn't already configured).
EDIT
After looking at your edit, it looks like you've created a Web Site Project rather than a Web Application Project. You can read about the various differences here:
Web Application Projects versus Web Site Projects in Visual Studio
If you haven't written any significant code yet, I'd suggest deleting the Web Site Project and creating a new Web Application Project. You'll then see the settings as described above.
If you really want to keep the Web Site Project, you'll have to configure the site in IIS and then open it in Visual Studio using the 'Open Web Site...' dialog (and then choosing Local IIS as the source):

Visual Studio putting web app dll in \bin\x64\debug instead of \bin\

IDE: Visual Studio 2010
.NET 4.0 x64 running on Windows 2008 R2 x64
All projects are configured for x64 platform.
When I compile the web application project, it puts all the required DLLs in the bin directory...HOWEVER, the web application's DLL is inside the \bin\x64\Debug.
This causes the dev web server (I use ultidev but this affects VS web server as well) to try to load the web application DLL from the \bin\ directory..but because it isn't there, it throws an exception failed to load type 'Global' (global.asax page). If I copy the web app dll from \bin\x64\debug to \bin\, it works fine.
Why isn't VS putting a copy of the web app dll to the \bin\ directory?
In the project properties (right click on the web project, at the bottom click properties) open the "Compile" section. You should see "Build output path" with a textbox below it and a browse button. Change the build output path to "bin\"
Due to another issue this didn't help me directly but did get me thinking.
I had to right-click on my project, "unload", then right-click again and edit the project.xml which included the outputPath variable.
That one was difference somehow so I edited it to point to "bin\", saved, right-clicked on the project one final time, choose "reload" and went about business as usual.
That solved my problem along with the issue of my break-points not being hit (because I had old files in bin\ which weren't getting cleaned up thanks to the bad path).

Resources