How to publish a virtual directory over IIS or XAMPP? - iis

I have a virtual directory that points to a virtual drive on sql server. I need this directory to be accessible over the Internet, how do I do that? I've tried adding a virtual directory to default IIS website
When navigating over to localhost/magentofiles this is what I get.
Of course it cannot find web.config...it's a directory not a project I'm trying to publish. Any help is much appreciated.

Since it didn't really matter whether to use IIS or XAMPP, I went with XAMPP because I could not solve the errors of IIS. Now here's how to publish a directory over xampp.
Create a directory in xampp/htdocs (let's say "files")
In cmd go to that new directory.
use mklink to create a symbolic link to your desired destination (let's say "images")
open up xampp\apache\conf\extra\httpd-vhosts.conf and at the bottom of the file append this code
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\files"
<Directory "C:\xampp\htdocs\files">
Options FollowSymLinks Includes ExecCGI
Require all granted
</Directory>
</VirtualHost>
Restart apache
You should be able to access files in that directory over localhost/images/example.png
Also note that the user, which xampp runs by should have access to the destination that you are publishing, otherwise you will get 403 Access forbidden.

There are many reasons for this error, you can try the following methods to solve the problem:
Right-click the website in your iis, then select Explore, check the current project folder if there is a web.config file, if there is then right click your web.config, expand properties, and under security tab, add IIS_IUSRS. Give the group read/write permissions.
Right-click the application pool of your current project, select Advanced Settings, and then change the Identity to LocalSystem.
Adding the IIS_IUSRS with read/write permissions to C:\inetpub\wwwroot.

Related

How do you allow IIS to access a symlink folder?

I have a two webservers, on each webserver in the C:\inetpub\logs\LogFiles I have created a symbolic link to the other servers log file folders, so essentially I can be logged in to one of the webservers and see the logs on both servers in one place. This works perfectly.
I am building a webpage to make the log files available via a webpage, the code simply goes to the C:\inetpub\logs\LogFiles directory and lists the files in each sub folder, i.e. W3SVC1 (the local folder) and webserver2-w3svc1 (the remote log folder).
For the local folders it works fine, but I am getting the "access denied" error when trying to call Directory.GetFiles on the symlinkd folder. I suspect this is some sort of permissions error, but I tried giving the symlinkd folder full permissions to "everyone" but I still get the same error.
Is this something to do with the fact that when I created the symlinkd I had to enter the username and password of the webserver2, and these credentials cannot be accessed/used by IIS when trying to get access to the folder?
Is there anything I can do allow IIS to access the contents of this symlinkd folder?
I don't think you need to use a symlink, you can create a virtual directory mapping to that directory in IIS, just map it to the target path. In IIS, right click on the website and select Add Virtual Directory.
For more information, please refer to this official document.
After much experimentation, the only way to do this is as follows:
Create a new user on the computer.
Run the AppPool in IIS under this new users' identity as opposed to the default IUSR account.
Give the folder you are sharing permissions to this user AND 'share' this folder with the new user.

How can I set permission to all new sub directories on windows server created by java?

I have a website hosted on IIS and I created a virtual directory ("pictures") which physical path is "C:/mydir/mysubdir". Inside "mysubdir" there are many sub-directories (for example: "123", "456" and so on ) containing images that are shown on the website with a regular html tag.
Until now everything is working fine and images are shown, the problem occurs when the back-end application hosted on Tomcat installed on windows server and connected to IIS goes to create new sub-directory under the physical path, the images inside the new folder are not shown due to an Unauthorized access 401, the work around I'm doing is set share permission all the times the user is creating new sub-directories via webapp but you can understand that is not possible do this all the time, this must work alone.
I already set all read/write permission to the Administrator account, even shared the parent folder and set the inheritance but is not working.
The owner of the folder is different if create from tomcat (LOCAL USER instead of Administrator) and I don't know if this could be a problem.
Please help me to find a solution.
Thanks in advance.
You could try the below steps to resolve the issue:
1)select your folder under which the new subfolder is creating by another user.
2)Right-click on the target folder/file and select Properties.
3)Security → Advanced.
4)click on the add and add user application pool identity(IIS AppPool\ (eg: IIS AppPool\smartcrypt)), iis_iusrs, and iusr.
5)by clicking on show advance permission set full control. and in applies to make sure it set to this folder, subfolders, and files.
6)click on and apply the setting.
7)in application pool identity set one of these network services, local system or application pool identity.

Possible to use Virtual Path to an external disk on Plesk Managed Windows server?

After getting a helpful answer from this post I want to store media on a separate harddrive on the windows server. Is it possible to make those files available via http?
I soon discovered that Plesk does not allow me to create a virtual path that points to a location outside of my website root. I want the virtual path to point to a folder on D: (an extra disk, not the same as the website root directory)
Only two possible solutions I could think of, although I can't find them any where.
1) Maybe plesk has an advanced configuration file that prevents it from overwriting certain things in IIS when it runs its maintenance jobs or updates, specifically the Virtual Path I created directly in IIS outside of plesk.
2) Maybe there is a third party component available that offers this functionality, setting virtual paths outside of web root or the config file I just mentioned in #1.
Any other solutions are also welcome.
cd "%plesk_vhosts%\"domain.tld\httpdocs
mklink /J point c:\outOfSpace
Now provide permissions to "psacln" group to c:\outOfSpace and that's it.
Also you can create "point" not in httpdocs but in web space root and than from Plesk create Virtual Folder inside /httpdocs with needed access permissions.
There is issue that your custom permissions may lost after Plesk upgrade, this KB article describe how your can avoid it kb.sp.parallels.com/111194

Cannot edit files in IIS localhost server

I have to edit a website on local server. I use Windows Server 2012 and IIS. When I try to save a modified file I only get "access denied" error. Do I need to shut down the server before making changes and then restarting it or am I missing permissions for example in the wwwroot folder for IIS_IUSRS?
I have never used WS2012 or IIS before.
You cannot edit files directly in the wwwroot. You need to copy the file/folder out of inetpub to make your edits then paste it back into the wwwroot. This is by design I am afraid.
I was able to do edits directly in the wwwroot files by creating a local user account for myself on the server and giving it FULL access (I am also in the Administrators group - but that was not enough to make it work), then setting the user full access on the SHARE I use to get to the server (via UNC path). Allows edits directly to my live site.

IIS7 - Uploading files with ASP problems

We've just moved our website to win2008 and IIS7 from win2000 with IS5 and I have some problems.
I have a folder that in it is an ASP page that upload a file to an upper folder, in the old IIS, I gave to the folder with the ASP page the permissions of the administrator and it's work fine, the files could be uploaded to an upper folders. BUT in the IIS7 I can't do it, I give to the folder with the asp code all the writing permission and it's not working. It's only work if I give a writing permissions to the upper targert folders. I don't wont to give to the target folders a full permission because those are the main web site folders.
So how can I do it? How can I give a folder a permission to write also to an upper folder that doesn's have this permmision?
Thanks
One possible reason is that you are attempting to access the parent with a MapPath and this is failing because Parent Paths haven't been enabled.
Since IIS6 the ability for code to access parent folders is by default blocked. To do this it is necessary to enable parent paths. In IIS7 parent paths can be enabled at Server, Site, Application or Folder level. In IIS manager click on the site, application or folder you want to enable this for, double click the ASP icon, in the Behavour section set 'Enable Parent Paths' to True.

Resources