How do you allow parent paths in Visual Studio 2013? - asp.net

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.

Related

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):

How to make asp.net app run with visual studio server instead of IIS?

I have downloaded this blog engine
https://github.com/lelandrichardson/MiniBlog
I cannot run it within Visual Studio because it wants IIS : how to change this ?
If your project doesn't load in Visual Studio (it is greyed out), you need to manually edit the project file (MiniBlog.csproj) in a text editor. You just need to look for the UseIIS tag, and change its value to False:
<UseIIS>False</UseIIS>
When you do the above, Visual Studio should be able to load the project. It should now default to the Visual Studio web server.
Once you are able to load the project in Visual Studio, you can choose another web server, if you wish. You just need to right-click on the project in the tree view and then select Properties. From there, if you open the Web tab, you can choose the legacy Visual Studio Web Development Server, IIS Express (you may need to install this), or the Server version of IIS.
Just a note - I was unable to actually build the project that you linked to. There appear to be missing dlls, but that is out of the scope of this question.
try to add IIS Express 7.5 for visual studio http://www.microsoft.com/en-us/download/details.aspx?id=1038

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).

Force IIS Express to Classic Pipeline Mode

How can I force IIS Express to run at classic mode? And I need that this configuration stays with .csproj, once that this file that say that a project should be open with IIS Express.
In Visual Studio 2010 select the Web Application project node in Solution Explorer then either:
Press F4
or
Navigate to View -> Properties Window or press F4
Important: Don't Right-click -> Properties from the right-click context menu for the project node in solution explorer because that will show the Property Pages for the project which is a whole different thing.
In the properties Windows you'll see the entry for Managed Pipeline Mode:
In Visual Web Developer 2010 Express it's more or less the same, again select the web project except press F4 to get that property page:
The only caveat is that if you share the project with others (say via source control), this setting isn't stored in the .csproj file but in the IIS Express applicationHost.config file specific to your user profile. So you'd need to ensure others configured this property in their own local applicationHost.config files in:
%userprofile%\Documents\IISExpress\config
All of the above also works with Visual Studio 2013 and 2015.
option-1:
In Visual Studio goto WebSite/WebApplication properties and change Managed Pipeline Mode to 'Classic'.
option-2:
Open %userprofile%\documents\iisexpress\config\applicationhost.config and locate your site in "Sites" section and change the app pool to classic (say Clr4ClassicAppPool).
If you want all the WebApplications/WebSites that you are going to create in Visual Studio to run in 'Classic' mode (by default), then in %userprofile%\documents\iisexpress\config\applicationhost.config file, then change the applicationDefaults app pool as shown below.
<sites>
........
........
<applicationDefaults applicationPool="Clr4ClassicAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>

Resources