How to Enable File System Access to Web Service?

2019-07-07 17:12发布

问题:

I have a C#/.Net app that is essentially a thick client data collection app. Given a part number, it does some DB queries (to an external Orcale DB), some Sharepoint queries, and also searches some network drives for related info. Now I'm trying to change this to a service-oriented architecture. The web service now resides on a server, and when called by a thin client, does the db queries, sharepoint queries, and file system queries and returns the results. All of this works well except file searches. The searches come up empty, I think because the web service is executing within its own little virtual file system, and cannot look out onto the network drives to scan the files it needs to scan.

Can someone recommend the correct way to allow protected read access to the network drives so the service can fetch the info it needs? I'm not looking to serve up these file directly to the thin client, just allow the service to have back-end access to the full array of network drives in our office. By the way the web service is hosted on IIS 6, Windows Server 2003.

回答1:

Depending on the user the web service is being run as (I can't remember what the default for IIS6 is but suspect it's essentially "NETWORK SERVICE"), it won't be able to read network shares if they're secured. Your best bet is to create a domain account for the web service to run under and use "Internet Information Services (IIS) Manager" to configure the application pool to run as said user (NOTE: For IIS 6 youy'll also need to add the user to the LOCAL user group "IIS_WPG").

One small note, you mention "network drives" throughout your question; your service will not share any of your mapped network drives, so you'll need to provide it with full UNC paths (i.e. \\server\share rather than m:\) for it to work.