Using Windows 7 I have installed the IIS Express 7.5 but I cant find where is the wwwroot directory on my system! There is no "inetpub" folder on my C drive as well.
Can you please let me know where I can put a file like hello.aspx file to be run?
Thanks
By first-hand experience and also by this other SO answer, usually IISExpress holds a directory with its own data files at: C:\Users\<username>\Documents\IISExpress.
There you can find the default directories for each web site log files (Logs\ and TraceLogFiles\) and especially you can find all web sites configurations in file config\applicationhost.config. That one has a <sites> section with a <site> node for each website created.
For each website, its <virtualDirectory> node specifies actual root location in physicalPath attribute:
<site name="YourWebSiteName" id="12345">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="D:\Physical\path\to\your\website\root"/>
</application>
...
</site>
C:\Users\YourUserName\Documents\My Web Sites\web-Site1
One simple way to test is just key in a test file in your site root, e.g.
http://localhost:1714/test.txt
System will throw a 404 error, in the "Detailed Error Information" section, system will show the "physical path" the server is trying to retrive the file.
Usually it is in your home directory. Something like c:\Users\<yourname>\Documents\IISExpress
you will see a location like below path
C:\Users\YOURUSERSNAME\AppData\Local\Temp\Temporary ASP.NET Files
But where is the global directory for IIS Express? Quick answer is
that there is not one. IIS Express is very much directory based.
That being said, the 2 solutions I have been able to work out are:
Add the group of files to your root path of your web site
Create a virtual directory in IIS Express’ applicationHost.config file for the location of your global files
More details
Related
I am trying to run some sample code for ASP.NET Core and Angular 2.
I cloned the project from https://github.com/PacktPublishing/ASPdotNET-Core-and-Angular-2 and changed the sdk version in the global.json to the current version I have installed (1.0.0-preview2-1-003177). When I run the web application I get the following error page:
I grepped the project looking for the config file path but came up with nothing. I also contacted support but they aren't helpful.
Does anybody know how to change the config file path?
You must open hidden .vs folder in root of your solution folder, then find applicationhost.config file in the config folder.
... and change
<virtualDirectory path="/" physicalPath="......"
to the proper path.
I clicked on create virtual directory of the web tab of the properties menu.
My application now isn't running (the published version is)
It just hangs when any of my controllers code is executed
I think I've messed up the IIS config
Can anyone help me out?
My file was located here:
C:\Users\YourUserName\Documents\IISExpress\config\applicationhost.config
Entries will look like this
<application path="/virtualDirectoryName" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\projects\Project1" />
</application>
None of this worked for me - possibly because I'm working with a later version of the tools (VS 2017). I finally found the correct appplicationhost.config file in the .vs directory for the solution, edited it, rebooted, and it worked.
If you created another virtual directory by mistake, go to your .vs folder inside your solution/project folder and look for a file called: applicationhost.config and change/fix what is inside the tag:
<sites>
<site name="YourSite" id="1">
...
</site>
...
</sites>
Hope this helps! :D
I realize this has been answered a few times over, but had this exact same issue in VS 2019 so I performed the following steps:
Closed the Solution
Navigated in the file system to the .vs folder within my solution and deleted it
Reopened Solution and rebuilt.
Upon reopening the solution and Starting the project, it appeared to have worked without any sort of reboot.
Some may consider deleting the .vs folder destructive in some way but given the fact it's normally excluded from most (if not all source control systems) there isn't really anything mission critical in there and it all gets rebuilt anyways.
I faced the same issue today. The simplest way to deal with this is just simply change the Port number. Go to the Properties of the Project which you have made as Startup Project.
Then...
Click to view => Step 1
Let's say the initial port number is 62168. Just increment it by 1.
Click to view => Step 2
And create a new virtual directory. Now execute the project again. This time it'll work.
Steps:
Go to Properties window of the project selected as the StartUp Project
Select the "Web" section present in the LHS of the Properties window
Go to the Servers part (which is present below the "Start Action" part )
In the Project URL section, increment the value of Port Number by 1 or 2 (modified Port number must be free) and click
on "Create Virtual Directory"
Save the changes and run the application using CTRL+F5
Hope this helps!
You can use appcmd.exe in C:\program files (x86)\IISExpress
appcmd list vdir should list the virtual directories and
appcmd delete vdir VDIR.NAME to delete. Or, if you use Powershell, the commands start with .\, e.g., .\appcmd list vdir.
VS 2019 -
There are multiple places that the applicationhost.config resides. Two of those should are where the virtual directory data is put.
First location:
C:\Users\YourUserName\Documents\IISExpress\config\applicationhost.config
Second location:
C:\YourPathToSolutionFolder\.vs\SolutionName\config\applicationhost.config.
** please note: in the .vs there are two folders one is the config folder and the other should be the name of your solution. Navigate into your solution named folder and you will find another config folder. Inside there is the applicationhost.config file you need to edit.
In both files you will need to remove the following (I just search for virtualdirectory).
<application path="/virtualDirectoryName" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\projects\Project1" />
</application>
Hopefully you won't have to delete the entire .vs folder which is an option if needed.
Note: This combines two answer from above Diego Murakami and BraveNewMath
I've got a .ps1 file that I would like to link readers to. Unfortunately, navigating to that URL only results in a 404. If memory serves, this is being "blocked" just like .config files, but there's a way to change that configuration in web.config ... but I can't seem to find the correct thing via search.
TL;DR, how can I expose a .ps1 powershell script so that it's accessible (though not executable, obviously) via HTTP.
I believe you need to add a MIME type for .ps1. In your IIS Manager, select the server node on the tree, and click "MIME Types". Then click "Add..." on the right panel. For extension, set it to .ps1, and set the MIME type to text/plain.
Now IIS should serve .ps1 files.
You could use a MIME Type of application/octet-stream instead of text/plain. Using the former will cause most browsers to download it rather than try to display it.
You can do this for a specific web application or virtual directory, too. If you are doing this through web.config, it would look something like this:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".ps1" mimeType="text/plain" /><!-- or application/octet-stream -->
</staticContent>
</system.webServer>
</configuration>
We used this same strategy for continuous integration with IIS static site resources - the powershell to do this same action is below in case this helps others wishing to script this change for CI. We were receiving HTTP 404s when asking for unlisted or non-standard file types (sql, ps1, etc.).
Add Additional Static MIME Type to IIS (.ps1)
Remove-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/staticContent" -name "." -AtElement #{fileExtension='.ps1'}
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -filter "system.webServer/staticContent" -name "." -value #{fileExtension='.ps1';mimeType='text/plain'}
This is re-entrant to support repeatable release deployments / desired state, etc.
I am trying to publish a Website project from a vendor that has ridiculously long paths to some of its files. When publishing, the error is:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
When I publish, Visual Studio 2012 Update 3 is attempting to write to a temp directory, and the prefix is quite long:
C:\Users\cuser\AppData\Local\Temp\WebSitePublish\MidasCMS400v9-1580334405\obj\Debug\Package\PackageTmp\
I thought I might be able to redirect VS to a different temporary directory at c:\tem by following this SO answer: Temp path too long when publishing a web site project
I create my publication profile, and as soon as I open it, there is an error indicating that WebPublishMethod is not an element of PropertyGroup. Regardless, I updated the file so it looks like this:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\Sites\MidasPublish</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
<AspnetCompileMergeIntermediateOutputPath>c:\tem\</AspnetCompileMergeIntermediateOutputPath>
</PropertyGroup>
</Project>
When I try to publish, I get the a modal box pop-up entitled "File Modification Detected", with the message "The project YourWebsite has been modified outside the environment", and it asks me if I want to reload. In my error list, I continue to get the error about the path being too long, as it is not attempting to use the c:\tem directory I identified.
I need to put this bloody thing onto a server, I am up for any solution that allows me to publish the bloody thing. I don't know much about the Website project template, so please let me know if there is a better way.
From http://forums.asp.net/t/1944241.aspx?Website+publish+failing+due+to+file+path+being+too+long
Add the following line in default PropertyGroup of web project file.
<IntermediateOutputPath>..\Temp\</IntermediateOutputPath>
You can likely make the above path C:\temp or ......\Temp (as needed to get it as close to root of the drive as possible.
In my case, there was no .csproj or .vbproj (website project file) but there was a website.publishproj file that warns you not to edit it, but I did anyway, and it did the trick.
Thanks to Stelvio, from http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2156195-fix-260-character-file-name-length-limitation , there is a solution :
Well, I found a workaround that ALLOW work with path with more than 260 chars.
Disclaimer: I've tried this trick only on Windows 8 x64 and Visual Studio 2013
So, to make it work I've just create a junction to the folder with the mklink command:
Assume this is the original path: d:\very\very\long\path\to\solution\folder, you can obtain a short link as d:\short_path_to_solution_folder just jaunching this command from a dos shell as administrator:
mklink /J d:\short_path_to_solution_folder d:\very\very\long\path\to\solution\folder
change source and destination path to you needs
Best Regards!
Stelvio
from this link :
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2156195-fix-260-character-file-name-length-limitation
While moving the project closer to the root file does work. I found a link to a solution that did work for me. The site also does a great job at discussion the issue as well as the details behind his solution.
Sayed Hashimi's solution to long path issue
EDIT:
To Summarize the provided link:
You can update your publish profile file, which is used by MSBuild, to include a replace rule that will shorten the path of your output when publishing to a web deploy package (Zip file).
For example, let's say publishing using the default profile created by Visual Studio, we get the following paths in the zip file:
archive.xml
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\bin
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\bin\WebApplication1.dll
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\index.html
Content\C_C\Temp\package\WebApplication1\obj\Release\Package\PackageTmp\Web.config
parameters.xml
systemInfo.xml
The trick is to replace all of the path defined after Content with a shorter path. In this particular example, replace the path with "website" in the PackagePath element.
One can edit the publishing profile file (.pubxml) and add the follow lines near the end of the file, just before the Project element is terminated.
<PropertyGroup>
<PackagePath Condition=" '$(PackagePath)'=='' ">website</PackagePath>
<EnableAddReplaceToUpdatePacakgePath Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='' ">true</EnableAddReplaceToUpdatePacakgePath>
<PackageDependsOn>
$(PackageDependsOn);
AddReplaceRuleForAppPath;
</PackageDependsOn>
</PropertyGroup>
<Target Name="AddReplaceRuleForAppPath" Condition=" '$(EnableAddReplaceToUpdatePacakgePath)'=='true' ">
<PropertyGroup>
<_PkgPathFull>$([System.IO.Path]::GetFullPath($(WPPAllFilesInSingleFolder)))</_PkgPathFull>
</PropertyGroup>
<!-- escape the text into a regex -->
<EscapeTextForRegularExpressions Text="$(_PkgPathFull)">
<Output TaskParameter="Result" PropertyName="_PkgPathRegex" />
</EscapeTextForRegularExpressions>
<!-- add the replace rule to update the path -->
<ItemGroup>
<MsDeployReplaceRules Include="replaceFullPath">
<Match>$(_PkgPathRegex)</Match>
<Replace>$(PackagePath)</Replace>
</MsDeployReplaceRules>
</ItemGroup>
</Target>
Now, the publish profile paths should look something like the following:
archive.xml
Content\website
Content\website\bin
Content\website\bin\WebApplication1.dll
Content\website\index.html
Content\website\Web.config
parameters.xml
systemInfo.xml
The answer of Jason Beck worked to me with a small change. To avoid the error "The IntermediateOutputPath must end with a trailing slash." use the "\" at the end of the path:
..\Temp\
Your "CONFIG_PUBLISH_FILE.pubxml" should look like this (The "..." omits other configuration that you file may have):
...
...
..\Temp\
...
At the time of publishing the project, the visual studio compiler checks the size of the files that are part of the project.
So I searched for long names in files.
I found and renamed those files.
Did Work perfectly
In my case it was because the default legacy string length limitation of windows. This was still set to 256-character limit.
To fix this, from an admin powershell session I ran the following command
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
I needed to reboot the system for the changes to take effect.
Microsoft reference document link here
This error comes because of long path name....U just cut your folder from current location to D drive or F drive. suppose your project folder name is "myproject", and you should cut this folder and paste to D drive of F drive,that your current path name will be D:\myproject or F:\myproject. Then you publish again......It will work...
I have WCF service folder let's say : "TestService" and it contains following folders and files under TestServide folder:
TestService folder contains:
1.bin (folder)
2.Config (folder)
3.TestService.svc (file)
4.WebConfig (file)
when I go to InetMgr and try browsing the TestService.svc file, the wcf service opens successully:
path:
https://localhost/TestService/TestService.svc
question
I cut and paste two files ( TestService.svc and WebConfig ) under bin folder. Now the folder heirachy changes as follows:
TestService folder contains:
1.bin (folder) contains
a).TestService.svc (file)
b).WebConfig (file)
2.Config (folder)
Now again I go under bin folder and open TestService.svc to open iexplorer it does not opens and gives following error.
path:https://localhost/TestService/bin/TestService.svc
error:page cannot be found
Technical Information (for support personnel)
Background:
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
More information:
Do I need to change anything so that my svc file will work??
If your web.config and TestService.svc are now in TestService/bin, you'll need to create an IIS web application pointing to that location.
You cannot have an IIS web application (virtual directory) pointing to "TestService" and then have your web.config and TestService.svc in a subdirectory of that IIS web app.
The IIS web app must point to the physical path where to web.config is located, and the *.svc files must be there in that same directory (not a subdirectory!), too.
Marc