Problem accessing Access DB file on a shared network drive

Vrom

Member
Joined
Feb 27, 2007
Messages
6
Programming Experience
1-3
Hi guys,

Got a question for anyone who can help.

I have deployed an application I created in VB.NET on a client's PC. The application accesses a local Access database file. Everything works fine.

When I move the locally stored Access DB file to a shared network drive, and update the appropriate connection strings in my app to reflect this change, the app will crash when it runs the next time with the usual Microsoft Send Error Report dialog box appearing. It gives you a memory dump and a System Unauthorized Access error message.

The shared network drive has full read-write properties enabled for the appropriate user.

However, the trouble is that once it crashes, even if you change the connection strings and move the Access file back locally, whenever you try to run it from then on it still refuses to work and crashes. Uninstalling and reinstalling the app bears no results. The only way I have found to get it to work again is by going into the appropriate user's Local Settings folder and renaming or deleting the local configuration files.

Is there a setting or a permission I need to set to get it to work on the shared network drive? Do I need to alter settings in the .NET framework? If so, what do I need to change and where do I need to change it? While on my development PC in Administrative Tools there is a 1.1 .NET framework configuration link and 2.0 .NET framework configuration link, on my client's PC where I deployed the app there is only a 1.1 .NET framework config link, even though .NET 2.0 is installed. Examining the link on my development PC, I discover that it points to a file in ProgramFiles\MSVisualStudio8, as compared to the 1.1 .NET config link which points to Windows\Microsoft.NET\Framework. So how do I configure 2.0 .NET framework if I don't have Visual Studio installed on that machine?

I know I've rambled on long enough and I've probably bored you guys, but any help would be greatly appreciated. Thanx.

Regards, Alex.
 
When I move the locally stored Access DB file to a shared network drive, and update the appropriate connection strings in my app to reflect this change, the app will crash when it runs the next time with the usual Microsoft Send Error Report dialog box appearing. It gives you a memory dump and a System Unauthorized Access error message.
.NET apps cant access network resources without explicit security permissions.
.NET apps cannot run from a network drive without explicit security permissions.

The shared network drive has full read-write properties enabled for the appropriate user.
The permissions are nothing to do with user file based security. They are part of the .NET code-execution security model, intended to prevent a malicious applet formatting your hard drive, for example. Java applets are subject to similar permissions within the java framework; its where microsoft got the idea.

However, the trouble is that once it crashes, even if you change the connection strings and move the Access file back locally, whenever you try to run it from then on it still refuses to work and crashes. Uninstalling and reinstalling the app bears no results. The only way I have found to get it to work again is by going into the appropriate user's Local Settings folder and renaming or deleting the local configuration files.
The local files are installed and their values remembered to provide persistence of e.g. user settings and preferences. Once installed they will be used. This is unrelated to the crashing; whether the app crashed on first run or not, the prefs would be set.

Is there a setting or a permission I need to set to get it to work on the shared network drive?
yes

Do I need to alter settings in the .NET framework?
yes

If so, what do I need to change and where do I need to change it?
I dont recall, probably you can grant network access to the assembly based on its location in the network, or installed name

While on my development PC in Administrative Tools there is a 1.1 .NET framework configuration link and 2.0 .NET framework configuration link, on my client's PC where I deployed the app there is only a 1.1 .NET framework config link, even though .NET 2.0 is installed.
MS took the dubious decision of removign the security policy configuration tool from the .net 2 framework installer. You now (their line) have to "install a 300mb add-on pack to get the config tool"

So how do I configure 2.0 .NET framework if I don't have Visual Studio installed on that machine?
Either install the 300mb add-on pack, or:

Search your dev machine for mscorcfg.*
Copy the DLL and the MSC to the same location on the client
At the dos prompt, REGASM (like regsvr32 but for .net DLLs) the DLL
Open the MSC

~50kilobytes and 5 minutes work. 300Mb MS lamers.. ;)
 
Thanx...

Many thanx cjard for your prompt and helpful reply.
Oh and sorry for posting this in the wrong forum...

Regards, Alex.
 
was it the wrong forum? I dont know.. I normally report posts that I feel are, and I didnt this time.. :) No need to apologise to me! (It's not like I say sorry very often, do unto others and all that)
 
Hello, i was having a similar problem. My friend found this link and thought I should post it here. It gives a very quick, easy solution.

http://weblogs.asp.net/rmclaws/archive/2007/03/22/work-with-net-projects-from-a-network-share.aspx

And in case the link ever expires here is the quotation:
I've tried a couple different methods from a bunch of different websites, and none of them worked. The only thing that worked for me was this post from the Microsoft Knowledge Base. It is the only place on the internet that gives the proper caspol command for issuing Full Trust to a network share. It is:

Drive:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\\computername\sharename\*" FullTrust -exclusive on

Note the 4 slashes after the "file" and then the 2 backslashes for the full network path. Trust me, it will save you a lot of headaches.
 

Latest posts

Back
Top