New Files In IIS virtual directory return file not found - asp.net

I have a virtual directory in IIS. and I added a new file to the physical directory that the virtual directory points to.
but when trying to access this file through the virtual directory - I get file not found (404).
I tried to restart the web site and the IIS Server - but it didn't help.
the file is a css file.

There may be permissions error on accessing the file so.
First set the permissions to full control over read /write..(Options->Security->...)
https://support.microsoft.com/en-us/kb/315122

You should generally put your static files under the Content folder in an MVC application. By default, this folder will be configured to skip the MVC routing rules. Google for MVC Content folder for more information.

Related

Azure Web App Wordpress how to add Virtual Directory?

Wordpress app is running fine at "/". I used the Kudu console to add a new filesystem folder, placed a hello.txt file in it, and then used the Path Mapping setting in the Azure portal to create a virtual directory to match.
I then navigated to the virtual dir in another web browser session, but Wordpress appears to be controlling the pathing because it gave the "not found" page.
How can I control the routes when I add another virtual dir to the app?
Thanks.
The below is my test to set the virtual directory.
Create the 'test' folder under 'site' folder in the KUDU, and put the 'test.txt' file in the folder.
Set the '/test' virtual path with site\test path.
Save the settings and restart the web, view the text file with the url https://your web name.azurewebsites.net/test/test.txt.

IIS8 looking for web.config in virtual directory rather than app root

I have a Virtual Application in IIS8, http://localhost:80/application/, the files for which are located in C:\inetpub\wwwroot\application. There is a web.config file in the ~/application/ folder.
Under the application, I have a virtual directory, http://localhost:80/application/vdir/, the files for which are located in J:\virtual_directory.
When I try to access a file under the /vdir/ directory, I get HTTP Error 500.19 - Internal Server Error, it says it cannot read configuration file at \?\J:\virtual_directory\web.config
Why is it looking for the web.config file there, rather than C:\inetpub\wwwroot\application\web.config? I have never had this problem in IIS 7, this is my first time setting this up on a Windows 2012 server.
(Note: J: is mapped to a shared folder on the network. Not sure if that makes a difference?)
Okay, turns out I had to do two things:
Create the virtual directory using the UNC path (\\servername\sharedfolder) rather than the mapped drive letter
use a network account in the Physical Path Credentials under advanced settings rather than the default Pass-Through Authentication

Questions about copy IIS config files to another server

I have several asp.net web services is running in IIS. Now I want to move to another server in all exactly same IIS setting and using same web services. I know about copying a IIS config files(ApplicationHost & administration) to new server remotely but do I also need to copy all asp.net files to new server as well? If yes then must the asp.net files be in the same file path directory as the current one(D:\Website) for IIS in new server to be able to recognize it?
Yes, you would need to copy the ASP.NET files as well.
It is not necessary to put them in the same file path directory. Whatever directory you put them in, ensure your IIS Website Settings point to that directory and you have setup the same set of permissions etc. on it.
e.g. You could have had a website on c:\site on one web server. you could move the website files onto another web server and put them on d:\newsite\ and change the Website Directory Path in IIS Manager to point to D:\newsite\ directory.

Giving 404 error in web site ? Asp.net?

In web application, i created a site and place the code in my domain [using filezilla i upload the my pages in my domain ]. i place my folder which contain the code in domain like
BusinessEntity Folder, BusinessLayer Folder, DataAccess Layer and my code Folder. my web.config is my code folder. but when i type my url it is giving 404 error. Can you help me to solve this problem. Thank you.
404 - Not Found error. Some resource can't be obtained. Open Fiddler or any other web debugger and check what request return 404 error. After that check existing a resource corresponding to Url
Please check all these things are done properly
Publish the project from your local machine (using visual studio)
Upload the published project to the server.
Create a virtual directory in iis (in the server)
Map the virtual directory to the project folder (means select the physical directory as the project folder)
Do the necessary configuration changes (conection strings or appsettings)
Give write permission for the upload folder and error folder (If you use any)
Checkout http://www.advancedinstaller.com/user-guide/tutorial-iis.html

IIS7 Creating Virtual Directory to files on another server

I am migrating some ASP.Net applications from IIS6 to IIS7 and all has gone well until now. I am trying to create several virtual directories on 1 server that will point to files on another server. In IIS6, all I had to do was make anonymous authentication use a user that had access to the files. In IIS7, I can't get it to work. I setup the virtual directory with the username and password but I get a 500.19 error "Cannot read configuration file due to insufficient permissions". I can't imagine that I really have to put a web.config in a directory that just contains images and no application files. If I click on the directory in IIS Manager, I get that error about the web.config file on anything that I click on such as the Authentication section. Also, writing to files from the virtual directory seems to work just fine so I don't think there is anyway that I have an access problem. I have given the directory access to the IIS_IUSR group.
When using a virtual directory that's pointed to a UNC share, go to advanced settings for the virtual directory, then choose a specific user account that has the appropriate rights to access the folder.
It works for my virtual directory in my asp.net app that is pointed to a UNC share on a remote server.

Resources