Debugging Visual Studio Website /w Nested Virtual Folder - asp.net

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.

Related

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.

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 2005 compile website

How can I compile website (not web project) using visual studio 2005?
Whenever I compile, those dll for the website app_code is not found in my website bin folder, but instead, in a temporary dll folder (C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files).
Is there anyway for me to have the compiled dll in the bin folder?
you can use publish web site feature:
In the publish Properties, check "Use fixed naming and single page assemblies".

Running aspnet web site starts on parent directory

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

How do I get the "Publish Website" command to emit PDB files for my Visual Studio 2005 Web Site project?

I have a VS 2005 Web Site project (not the web application project model, the 'web site' project model) and I want to be able to include the PDB files for the page assemblies in the bin folder via the "Publish Website" command within Visual Studio to help out with debugging an issue.
No matter what I try with regard to the "Debug/Release" mode settings, I can't seem to get PDB files for the website assemblies to show up in the 'bin' folder once I've published the site. I do get them for any externally references assemblies, but not for the actual website code-behind assemblies, which is what I need.
How do I get Visual Studio to include these files when publishing using the web site project model?
The Publish command always compiles your project for release and I haven't found a way to cause the pdb files to be generated during the precompile.
There is a workaround I have tried. If when you precompile you check the box "Allow this precompiled site to be updatable" and then update the web site in place this results in a dynamic compilation. The dynamic compilation should produce debug code and pdb files if your web.config settings has:
<compilation defaultLanguage="your language" debug="true" />
Here is a good blog post about the different publish options.

Resources