Reputation: 75
I am trying to Access mapped network drive from wcf service hosted on IIS7. It says path could not be found. However when I m using visual studio development server, it is able to access it. I have tried impersonation but of no avail. Please let me know what are the settings I have to set in IIS And also on File server if any. Thaks in Advance
Upvotes: 1
Views: 3162
Reputation: 693
I know this is an old post, but thought I'd share my solution. Had the same problem; couldn't access a network drive from my WCF running in IIS. I tried a virtual directory providing my network credentials which didn't work.
The solution that worked for me was to create an application pool in IIS for my service to run under. Then I gave the application pool network credentials. Changed my service to run inside this application pool and now the service can access the network share.
So my steps were:
1) Create a new application pool in IIS. Right-click 'Application Pools' in the Connections window. Then 'Add Application Pool...'. Give the new pool a name and choose the framework. I left the other settings as default. 'Ok'.
2) Change the identity of the new application pool. In the Application Pools list, right-click on your new pool and go to 'Advanced Settings'. Under 'Process Mode', open the 'Identity' details. Select 'Custom account:' then provide the network credentials that have access to the network share. Then 'Ok', 'Ok'.
3) Change the pool your service is running in. Select your service application then click 'Basic Settings...' (on the Actions pane). Click 'Select...' in the pop-up. Change the Application Pool to the new pool you created. Then 'Ok', 'Ok'.
Now your service should be able to access the network share using the supplied credentials. You can test using your credentials but I'd recommend using a service account (virtual account with no password reset policy) when you deploy your service.
Hope this helps others!
Upvotes: 1
Reputation: 63264
http://support.microsoft.com/kb/257174
Drop that mapped drive approach and use UNC path instead.
Upvotes: 1