What's the standard or common practice to setup the local path of a website in IIS. Is it c:/inetput/MYWEBSITE or c:/inetpub/wwwroot/MYWEBSITE?
According to this article you can go either way. Should I put my ASP.NET websites in the wwwroot folder?
Thx for your feedback.
There is a wwwroot folder under Intepub. The path may looks like C:\inetpub\wwwroot
But you don't need to put under Intetpub to make your site work. you can put in any other folder also and just map the location to that folder in your website settings under IIS.
It is just personal choice. Both places works. I personally keep it under another folder because sometimes i forget to take backup of my inetpub.
Related
I need to integrate a third party plugin in my asp.net website. To install the plugin, they have mentioned this sentence, "Create an application through your IIS control panel with root directory at -(some path from my website folder)?".
I am not much aware with IIS and rarely worked with it. Though I tried every possible way I could do in IIS, I am not able to work it out. After installation, there is a test page provided by plugin which I have to run to check but when I run it, it shows this error.
"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."
I searched this error too and found that it is because the two Web.Config file, one from the main project and another from plugin folder. The only way to work with this, is to make the plugin folder they specified as a root directory in IIS. Someone kindly tell me some easy steps to do this.
What I was doing is, in IIS6, I added New website with the main folder of my asp.net website, then I right click>add application and choose the given path, thought it would become root directory but it is not.
Help would be appreciated. Also note that, I have to put the plugin folder in my main website folder only. So, there are two web.config. I tried to rename one of them too, it solved the above error but gave another errors but I think main problem is of root directory. P.S they show me above error on web.config file of plugin folder on this sentence-
"Line 51:
< authentication mode="Windows" />"
Most of the times the root directory is C:\inetpub\wwwroot folder and "Default Web Site" on IIS Manager.
Open IIS Manager and under Sites there should be IIS websites and under it you will probably see Default website. You can see the root directory with Right click/Settings.
Copy your website files under this root directory.
And after copying folder to root folder you will see this folder under Default websites on IIS.
Right click your directory name on IIS and "Create Application", select correct .net framework.
It should be work. Good luck, if you need more help please give more details on your server IIS.
What is the difference between publishing a website to {localdrive}\inetpub\wwwroot and anywhere else on the web server e.g. C:\Website.
I have noticed that I am always left with a directory and a website in the IIS console if I publish to {localdrive}\inetpub\wwwroot.
After reading articles on MSDN, I am still unclear of the difference. I realise that there is probably a simpe answer to this, but I cannot find it.
The web path / is already mapped to c:\inetpub\wwwroot, so /abc is mapped to c:\inetpub\wwwroot\abc automatically.
When you publish to c:\website, you need to set up a virtual path manually.
Nothing too much as your website path in IIS can point to any directory. However, that being said always double check your directory permissions and security settings. In addition, I guess if a hacker did compromised your webserver... the default c:\inetpub\wwwroot is well known.
And just for good measure in case you are having issues - check out the Aspnet_regiis.exe tool on MSDN as it usually solves a lot of issues for folks.
{localdrive}\inetpub\wwwroot is usually used for the default web site that comes with IIS.
Additional Microsoft products use the same directory and take advantage of the virtual directories that exist in the default site.
If this is your personal web site, or a web site you created from scratch, you can publish anywhere you want.
Before you publish, you need to make sure IIS knows where the directory will be, and you need to assign the correct permissions for that folder.
The default website in IIS is mapped to C:\inetpub\wwwroot by default, so publishing to wwwroot makes it easy to add applications as virtual directories.
However, you can publish wherever you like, and either point a virtual directory or new website at your publication location. You simply need to make sure user the App Pool is running as (usually IUSR under IIS7, IUSR_MachineName under previous versions) has read/execute permissions on the folder you are publishing to.
Although they say Virtual Directory created by default for your website in wwwroot and you don't have to configure it again. Many times I found we still have to go there and click on Remove and then click on Create button again :)
Thus it is almost no problem if you create your website outside wwwroot, only difference outside you have to give full path of VD and inside you have to click Remove and then Create button
The problem I had was different from all of the above. I was trying to publish in "C:\inetpub\wwwroot" and the publish failed every time. Than i changed the publish folder to another and it worked. When I launched visual studio as administrator I could copy to C:\inetpub\wwwroot also without problems
I previously made my "Web Applications" type of projects inside some individual directories
and have been making "Web Site" types (based on visual studio's project types") inside IIS.
Although It should be a repetitive task but I want to know the most usual needed steps for doing so
What I need :
Access to the media with absolute paths
As an example
I placed my project inside "IIS Root folder/ProjectBase/Project"
and convert that to Web Application via IIS.
It seems that I couldn't access to my stored media files within the Project Folder.
What is the exact problem in this case ? Is it related to folder permissions of the "Project Folder" ?
Also should I make the "ProjectBase" Folder also a virtual directory ?
the program is running via cassini,
At first I want to have access to my Project based files via "absolute paths"
As a conclusion
Having "Web Application" Type running with possibility to access to its files via absolute paths.
It should be an easy task for the Pros, but, anyway I'm in hurry and needed good-fast advice.
thanks in advance
Could be a file permissions issue. You can resolve that by going through IIS and setting the permissions on the folders. Grant read/write to the IIS user for that machine. If you're actually writing anything back you may need to grant access to Network_Services as well.
Also you can look at adding a virtual directory to the website in IIS and point that to the actual physical directory on the box. That has solved some file access issues for me in the past.
Im working with asp.net 2.0, and i have a folder into my application path ~/Data/ with some .mdb files.
I would like to protect this folder from external request like http://www.whatever.com/Data/whatever.mdb
But i would need to give any permission to my application, cause im using OleDBConnections agains the ~/Data/ Path.
What could be the best way to protect this folder?
Kind Regards.
Josema.
In IIS manager and remove at least anonymous access if not all access. Your application code can continue to use its contents but HTTP requests can not access it.
If possible in your situation, another option would be to place the mdb files outside of the website. For example, something like this directory structure:
/ MyProject
/ Data
- whatever.mdb
/ www
- Default.aspx
where www is the actual root of your website. That way, users will never be able to access the mdb files from the browser, while you can still use OleDBConnections against the mdb files. To my knowledge this is pretty secure, and this way you can't accidentily forget to disallow access in IIS.
Did you check if it actually is a problem?
I'm using ASP.NET 3.5 here but the default App_Data folder is shielded for downloading. Maybe you should just follow the guidelines and verify.
As for the other answers about moving Data outside your Web folder, that usually won't work when you use a hosting provider.
I'm moving some ASP code from one server to another. The location names are slightly different and I suspect that now the "global.asa" isn't getting called properly. The location is in c:\Inetpub\wwwroot\myApp.
It belongs in the root folder of your application. Also make sure that that folder is a application in the IIS manager. There is a textbox for application name, and right next to it a button "Create", if the folder isn't already an application.
Make sure that "myApp" in IIS is defined as an application. I would also check the .Net application mappings to make sure .Net is handling your requests.
The global.asa should be in the root of your virtual directory. Note that global.asa is used by asp not asp.net.
You can generally tell by looking at IIS Manager whether or not your directory is a virtual directory as it will not look like a yellow folder. If it does look like the typical yellow folder, right click the parent "Default Web Site" or whatever, and choose new virtual directory.
Alternatively, the global.asa can go in the root of the Web. Which is typically C:\inetpub\wwwroot if you are using the "Default Web Site"
For convenience, I want to keep in a subdirectory. Apparently, you have to designate that directory as an application. Here's a link that describes how:
http://www.calcaria.net/ASP/2006/04/globalasa-file-doesnt-work.html
Generally, I'm against the idea of files which are called auto-magically and not referred to in the code. If you are a noob like me, you can go off the rails for a while, before you track it down. I just lost a couple of hours on this silliness.