IIS - Access denied directory

Asked

Viewed 3,034 times

2

I am using windows server 2008 and IIS 6.1, I have a service that needs to access files in a certain directory, but I do not have access.

What I need to configure to get access?

inserir a descrição da imagem aqui

After adding Administrator as the user, the application says that the directory does not exist.

    List<FileInfo> files = new List<FileInfo>();

    if (Directory.Exists(@"C:\Users\Administrator\Documents\MovieCollector\PacotesSerializados"))
    {
        foreach (string file in Directory.GetFiles(dataFilePath))
        {
            FileInfo fileInfo = new FileInfo(file);
            files.Add(fileInfo);
        }
    }
    else
    {
        throw new Exception(dataFilePath+ " não lexiste");
    }

    files.Sort((x, y) => y.CreationTime.CompareTo(x.CreationTime));

    if (files.Count == 0)
    {
        throw new Exception("Lista vazia");
    }
  • If you have any users who have access to this directory, you can give permission to the user who runs on IIS. Or I’m still not sure if this is how it works in this version of IIS, but you can define the user you want to connect your application to in IIS, in IIS8 is the option "Connect as...", so there set a user with the privileges in the directory in question. (Maybe it’s a similar option (I don’t have an IIS 6.1, to test))

  • I added Administrator as the user, but says that the directory does not exist. I added an image that shows the error in the client and the directory on the server.

  • What code is executed to generate the specified exception?

  • Added the code used to recover the files.

  • Have you tried adding the group everyone with reading and writing in this directory?

1 answer

1

Italo you have already given full permission to the IIS_IUSRS user in the Pacotesserialized folder. Also see if there is the MIME type. xml or extension used in IIS.

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.