Shared Network Path Unavailable

G

Guest

Hi,

I am facing a problem in accessing a network shared folder. I just wrote a
test console application to test the behavior and found that in some cases
the .NET does not releases the network connection after accessing the folder.

I am not instantiating object which holds the network resource, so in my
case no cleanup or dispose is required (assuming). I am just using the
Directory.Exists() static method to check whether a directory exists or not.

<CODE>
string path = @"\\systemname\test";
if(Directory.Exists(path))
Console.WriteLine("Available.");
else
Console.WriteLine("Not Available.");
</CODE>

In general this code works fine most of the time but in some cases the
connection made by .NET exceeds the maxconnection limit, and so the folder
becomes unavailable.

To reproduce this error share some folder with maxconnection limit 1 or 2.

As I am executing this code on one system so logically there should be one
connection between the two systems, even when i instantiate multiple
processes.

Please help me in understanding this behavior of .NET.

Thanks in advance.
 
G

Guest

Hi,
I am facing a problem in accessing a network shared folder. I just wrote a
test console application to test the behavior and found that in some cases
the .NET does not releases the network connection after accessing the folder.

I am not instantiating object which holds the network resource, so in my
case no cleanup or dispose is required (assuming). I am just using the
Directory.Exists() static method to check whether a directory exists or not.

<CODE>
string path = @"\\systemname\test";
if(Directory.Exists(path))
Console.WriteLine("Available.");
else
Console.WriteLine("Not Available.");
</CODE>

In general this code works fine most of the time but in some cases the
connection made by .NET exceeds the maxconnection limit, and so the folder
becomes unavailable.

To reproduce this error share some folder with maxconnection limit 1 or 2.

As I am executing this code on one system so logically there should be one
connection between the two systems, even when i instantiate multiple
processes.

Please help me in understanding this behavior of .NET.

Thanks in advance.

I forgot to mention that I am using Windows200 professional on both systems.
And .NET ver1.1 with Hotfix KB886903.

Hope it will help in analyzing the problem.
 
W

Willy Denoyette [MVP]

If you run multiple instances of this code from within the same logon
session, there should only one connection active (well , one session to be
precise), all instances share the same 'connection'.
So when you have problems it means that there are multiple sessions active.
You can check the number of sessions and their originator at the server
using Net commands or the Server applet.

Willy.
 
G

Guest

Hi Willy,

Thanks for your response.

There are times when session count reraches 0 but #Connections is not 0.
Not able to understand the behavior but sometimes session count reaches 0
but #connection is 2 (Maxconnection) and that causes refusal to further
connections to that folder.

--
Cheers,
Rahul Anand


Willy Denoyette said:
If you run multiple instances of this code from within the same logon
session, there should only one connection active (well , one session to be
precise), all instances share the same 'connection'.
So when you have problems it means that there are multiple sessions active.
You can check the number of sessions and their originator at the server
using Net commands or the Server applet.

Willy.
 
W

Willy Denoyette [MVP]

Rahul Anand said:
Hi Willy,

Thanks for your response.

There are times when session count reraches 0 but #Connections is not 0.
Not able to understand the behavior but sometimes session count reaches 0
but #connection is 2 (Maxconnection) and that causes refusal to further
connections to that folder.

Not sure what you are looking at and what tol you are using to get at these
figures, as far as I know there is no such thing like connections on a
LanManager share. There are sessions that are bound to client logon sessions
and there are opens which be part of multiple sessions. If you have 2 as
max. number of users (I guess this is what you mean with #connection) you
can have at most two (user) sessions open to the share, but one single user
can have multiple files and folders open at any one time. So I realy don't
see what you may have as problem, unless you are trying to open more than 2
sessions. In the latter case you should know that LM keeps a session open
for a OS specific time-out period after the last file has been closed.

Willy.
 
G

Guest

Rahul Anand said:
Not sure what you are looking at and what tol you are using to get at these
figures, as far as I know there is no such thing like connections on a
LanManager share. There are sessions that are bound to client logon sessions
and there are opens which be part of multiple sessions. If you have 2 as
max. number of users (I guess this is what you mean with #connection) you
can have at most two (user) sessions open to the share, but one single user
can have multiple files and folders open at any one time. So I realy don't
see what you may have as problem, unless you are trying to open more than 2
sessions. In the latter case you should know that LM keeps a session open
for a OS specific time-out period after the last file has been closed.

Willy.

I am checking the number of sessions under "Computer Management" console.
Under 'Shares' there is something called '# Client Redirections' I guess it
is the number of clients connected to this shared folder.

When I directly open multiple explorer on the shared folder (from one
system) I never get any error; that is the maxconnection limit (i have set it
to 2) is never reached. In this case the number of '# Client Redirections' is
always 1.

But when I connect the same folder through my .NET code (just trying to
check the availability of shared folder with Directory.Exists()), the count
reaches 2 in some cases (not always) and that causes the folder to become
unavailable as maxconnection is reached and so no more connection can be
allowed. After a few seconds the 'Sessions' shows no open session but the '#
Client Redirections' count doesnot drop to 0 for some more minutes (around
15-20 minutes).

I guess in some cases the .NET is not releasing the connection properly.

I think these details will help you in better understanding the problem I am
facing.

Thanks in advance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top