I am using the Win23 API WNetCancelConne ction2 and can sucessfully make a
connection to a share within my class. The class is called from a Windows
Form based test harness.
When I instantiate exactly the samce class from a Windows Wervice, I get "A
specified logon session does not exist. It may already have been terminated"
.. The error number is 1312.
I know the code to be good, so I suspect something around security / windows
accounts etc.
Any pointers?
(FYI I am using VB.Net and am an Admin on the machine) 5 8813
You'll probably need to set the service to login under a specified user that
has access to the network share, and also has rights to login as service.
(The default is to login as the "System" user which is a local account, and
will not have access to network resources.)
Lance
"JohnFol" <Ou************ @WibbleObbble.C om> wrote in message
news:T6******** *********@newsf e3-win.ntli.net...
I am using the Win23 API WNetCancelConne ction2 and can sucessfully make a
connection to a share within my class. The class is called from a Windows
Form based test harness.
When I instantiate exactly the samce class from a Windows Wervice, I get "A
specified logon session does not exist. It may already have been terminated"
.. The error number is 1312.
I know the code to be good, so I suspect something around security / windows
accounts etc.
Any pointers?
(FYI I am using VB.Net and am an Admin on the machine)
Thanks for the ideas. Just to be clear, in "test" I validate my account
against a domain controller. My API call specifies a completely different
username / password.
I think the key point you are making is a Windows Service may not have
access to any network resources if started up as "LocalSyste m"
I'll give it a bash,.
Many thanks
"Lance Wynn" <la********@N.O .S.P.A.M.hotmai l.com> wrote in message
news:ek******** ******@TK2MSFTN GP15.phx.gbl... You'll probably need to set the service to login under a specified user that has access to the network share, and also has rights to login as service. (The default is to login as the "System" user which is a local account, and will not have access to network resources.)
Lance
"JohnFol" <Ou************ @WibbleObbble.C om> wrote in message news:T6******** *********@newsf e3-win.ntli.net... I am using the Win23 API WNetCancelConne ction2 and can sucessfully make a connection to a share within my class. The class is called from a Windows Form based test harness.
When I instantiate exactly the samce class from a Windows Wervice, I get "A specified logon session does not exist. It may already have been terminated" . The error number is 1312.
I know the code to be good, so I suspect something around security / windows accounts etc.
Any pointers?
(FYI I am using VB.Net and am an Admin on the machine)
"JohnFol" <Ou************ @WibbleObbble.C om> wrote in message
news:T6******** *********@newsf e3-win.ntli.net... I am using the Win23 API WNetCancelConne ction2 and can sucessfully make a connection to a share within my class. The class is called from a Windows Form based test harness.
When I instantiate exactly the samce class from a Windows Wervice, I get "A specified logon session does not exist. It may already have been terminated" . The error number is 1312.
I know the code to be good, so I suspect something around security / windows accounts etc.
Any pointers?
(FYI I am using VB.Net and am an Admin on the machine)
Not sure what you intend to do with this "WNetCancelConn ection2" call, you
can only cancel connections running in the same logon session as the current
session. Did you establish a network connection from within the service?
Willy.
Good grief, not only did I write Windiows Wervice, but I cut'n'paste the
wrong API!
Appologies to all.
The Correct API is "WNetAddConnect ion2"
FYI I tried one of the other suggestions and set the project installer to
use NetworkService. On my PC this is great, but on a.n.other server (where I
log on as Admin to install) I get
"The account name is invalid or does not exist, or the password is invalid
for the account name specified."
Unless I can install it I cannot set the account under which it runs, soI'm
a bit stumped.
"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. "JohnFol" <Ou************ @WibbleObbble.C om> wrote in message news:T6******** *********@newsf e3-win.ntli.net...I am using the Win23 API WNetCancelConne ction2 and can sucessfully make a connection to a share within my class. The class is called from a Windows Form based test harness.
When I instantiate exactly the samce class from a Windows Wervice, I get "A specified logon session does not exist. It may already have been terminated" . The error number is 1312.
I know the code to be good, so I suspect something around security / windows accounts etc.
Any pointers?
(FYI I am using VB.Net and am an Admin on the machine)
Not sure what you intend to do with this "WNetCancelConn ection2" call, you can only cancel connections running in the same logon session as the current session. Did you establish a network connection from within the service?
Willy.
"JohnFol" <Ou************ @WibbleObbble.C om> wrote in message
news:71******** *******@newsfe6-win.ntli.net... Good grief, not only did I write Windiows Wervice, but I cut'n'paste the wrong API!
Appologies to all.
The Correct API is "WNetAddConnect ion2"
FYI I tried one of the other suggestions and set the project installer to use NetworkService. On my PC this is great, but on a.n.other server (where I log on as Admin to install) I get
"The account name is invalid or does not exist, or the password is invalid for the account name specified."
Unless I can install it I cannot set the account under which it runs, soI'm a bit stumped.
Note that the "NetworkService " account is only available on XP and W2K3.
On W2K or NT you should run your service using domain account credentials.
Willy. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: moonriver |
last post by:
I write a program accessing files in network drive o:. It is doable as a standalone application. However, if it is running under windows service, the following exception will appear:
13/07/2004 10:24:48 AM run() error: System.IO.IOException: The specified network password is not correct.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare...
|
by: Tommy.Vincent |
last post by:
Hi,
its newbie question.
I have one production server(A) ,one backup server(B),additional
server(C).
my database backup are moved from A to C in regular basis.
My problem is that when ever I have to restore my database in Backup
|
by: Niloday |
last post by:
Hi All,
I am trying to access a mapped network drive from a service that I have
created.
The service needs to create/delete folders/files on a network drive. When I
tried to connect to a folder on mapped network drive (eg. N:\Storage that
corresponds to \\FS1NS\SharedDir\), I get an error as "Could not find part
of path N:\".
|
by: Jim Bayers |
last post by:
Our network nazi doesn't want us running a webserver on the server that
has a connection to the campus database so we created a remote object
that runs as a windows service. The windows service runs on the server
with a connection to the campus database and we make calls to it. My
question is, how best to connect to this object via asp.net, in an aspx
page?. The example I had used a console ap to connect and that works,
but we want to...
|
by: felecha |
last post by:
I'm working on a system that has a several computers that run an
alerting system. There are 2 "Host" machines that have no user
interface, and one "Admin" station that has an Administrator's
application for configuring and reporting. They are on a simple
local network, just the 3 machines, no wider access.
We do a certain amount of communication between them, using UDP and
MessageQueueing and also in one instance a VB.Net Windows Forms...
| |
by: JohnFol |
last post by:
I have some code working that uses the API WNetAddConnection2. The code is
used from a Windows Form and on my PC it works. If I package the code and
deploy to a server the code fails with an error
"The following exception has occured: Unable to connect network drive. Win32
error code is: 67 (The network name cannot be found.)"
This is when I am logged on as the administrator of the local machine. I
thought it might be the fact I am not...
|
by: JohnFol |
last post by:
I am using the Win23 API WNetCancelConnection2 and can sucessfully make a
connection to a share within my class. The class is called from a Windows
Form based test harness.
When I instantiate exactly the samce class from a Windows Wervice, I get "A
specified logon session does not exist. It may already have been terminated"
.. The error number is 1312.
I know the code to be good, so I suspect something around security / windows...
|
by: Miriam |
last post by:
Hello,
I created a Windows Service in VB.NET, which is to purge files periodically
in the local system and also in the shared network drive. Here is my problem:
1. If I set the “Account” property of ServiceProcessInstaller to “Local
Service” or to “NetWorkService”, it won’t work for both local and network
shared directories.
(I use log on as this account “NT AUTHORITY\LocalService” for “Local
Service” or “NT...
|
by: Michael |
last post by:
We have an ASP.NET 2.0 web application running on a Windows 2003 domain
controller. Part of that application needs to read and write files from and
to a network share ( living on a MAC Xserveraid) on the same network segment.
I mapped a drive on the server to that share. When mapping the drive, I
could enter access credentials for the shares (an account from the Mac side
that does not exist in the windows domain). Using Windows Explorer,...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |