locked
Access to the path 'NuGet\Cache' is denied. RRS feed

  • Question

  • User1618343281 posted

    Hello

    I'm trying to make a small packagemanager for my website. And I'm looking at this blogpost:

    http://www.aaron-powell.com/creating-a-nuget-plugin-engine

    But I get "Access to the path 'NuGet\Cache' is denied." when trying to test it. I've added ASP.NET account so it has full rights on c:\inetpub, and still same error.

     

     

    public void TestInstall(string packageID)
    {
    var rep = PackageRepositoryFactory.Default.CreateRepository(new PackageSource("http://testserv.test.se/nuget", "Default"));
    
    var packagemgr = new PackageManager(
    rep,
    new DefaultPackagePathResolver("http://testserv.test.se/nuget"),
    new PhysicalFileSystem(@"c:\inetpub\TEST")
    );
    
    var package = rep.FindPackage(packageID);
    
    packagemgr.InstallPackage(package, false);
    }

     

     

    I can't find the folder on the server where I've published the files to. 

    Whats needed to be done to make this work? I'm trying to install a package to a newly created instance in the IIS. And that app-pool has full rights to c:\inetpub on that server.

    I would appreciate any help. 

    /M

     

    EDIT:

    If add "Packages" so URL is: 

    http://testserv.test.se/nuget/Packages

    I get error:

    The request URI is not valid. Since the segment 'Packages' refers to a collection, this must be the last segment in the request URI. All intermediate segments must refer to a single resource.

     

     

    Wednesday, May 4, 2011 2:54 AM

Answers

  • User-121157572 posted

    As the error clearly says you don't have permission to use/create the folder.
    Normally web application runs under ASP.NET user acoount and this account doesn't have any file permission in your system.
    So you have to give permission to this user account or you can enable impersonation.
    I would suggest you to enable impersonation instead of giving more permission to ASP.NET account due to security issue.

    Create a new user account with local admin rights and have an entry in your web.config like below.

    	<system.web>
    		<identity impersonate = "true" userName = "Username" password = "password"></identity> 
    	</system.web>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 4, 2011 5:04 AM