简体   繁体   English

iis上部署的asp.net的访问被拒绝

[英]access denied for asp.net deployed on iis

I Have an asp.net web application that access files on shared folder from remote host, when the web application is run from vs2008 it retrives the image files and display them.how ever when i deploy the same project in IIS using virtual directory, the application couldn't access the files on the shared folder it says access denied. 我有一个asp.net Web应用程序,可从远程主机访问共享文件夹上的文件,当从vs2008运行Web应用程序时,它会检索图像文件并显示它们。但是,当我使用虚拟目录在IIS中部署同一项目时,应用程序无法访问共享文件夹中的文件,显示访问被拒绝。

is there any persmission setting i needed to add, I have already add the Asp.net and network service to the project files on the phsical path where the virtual path is pointing too. 是否需要添加任何权限设置,我已经将Asp.net和网络服务添加到虚拟路径也指向的物理路径上的项目文件中。

    string pic3 = @"\\M37350\temp\GraphicUserImage.jpg";


        FileInfo f = new FileInfo(pic3);


        if (f.Exists)
        {

            Image1.ImageUrl = pic3;
            Image1.Visible = true;
        }

Thanks. 谢谢。

VS2008 is using your credentials when executing web application. VS2008在执行Web应用程序时使用您的凭据。 You will need to set up an account (one that has access to the remote folder) in your IIS virtual directory. 您将需要在IIS虚拟目录中设置一个帐户(可以访问远程文件夹的帐户)。

you'll need to set the Application Pool's Identity to a domain account ( domain\\user\u003c/code> ) with access to this shared folder, the built-in "Network Service" account doesn't have access to a remote shared folder. 您需要将应用程序池的标识设置为具有对此共享文件夹访问权限的域帐户( domain\\user\u003c/code> ),内置的“网络服务”帐户无权访问远程共享文件夹。

To change your App Pool Identity: 要更改您的应用程序池标识:

you'll need to know which Application Pool your website is using by going to the Website properties "Home Directory" tab (Application Pool is the last item) 您需要通过转到网站属性“主目录”标签来了解您的网站正在使用哪个应用程序池(应用程序池是最后一项)

网站属性-主目录选项卡(IIS6)

Close out the Website properties and under Application Pools in IIS find the corresponding Application Pool, open properties and go to the "Identity" tab to change the user. 关闭网站属性,然后在IIS中的“应用程序池”下找到相应的应用程序池,打开属性并转到“身份”选项卡以更改用户。

应用程序池属性-“标识”选项卡(IIS6)

Might also check this answer on serverfault.com: Permission for ASP.NET application on web server to access shared folder on another server 可能还会在serverfault.com上检查以下答案: Web服务器上的ASP.NET应用程序访问另一台服务器上的共享文件夹的权限

And this step by step for setting custom app pool identity ASP.Net and IIS Support Team Blog for Microsoft France 并逐步设置用于Microsoft France的自定义应用程序池标识ASP.Net和IIS支持团队博客

You need to chmod the shared folder so it is readable and writable to you and/or others. 您需要chmod共享文件夹,以便您和/或其他人可以读写。 Usually the host has an interface for this. 通常,主机为此具有一个接口。 As far as I know, the permissions cannot be set from code. 据我所知,权限不能通过代码设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM