Re: Connecting to a network share not working in a Windows Service



Good grief, not only did I write Windiows Wervice, but I cut'n'paste the
wrong API!

Appologies to all.

The Correct API is "WNetAddConnection2"

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]" <willy.denoyette@xxxxxxxxxx> wrote in message
news:%230zylsiWFHA.3076@xxxxxxxxxxxxxxxxxxxxxxx
>
> "JohnFol" <OutlookExpress@xxxxxxxxxxxxxxxx> wrote in message
> news:T62ie.5472$8K5.1477@xxxxxxxxxxxxxxxxxxxxxxx
>>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 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 "WNetCancelConnection2" 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.
>
>
>


.



Relevant Pages

  • Re: Problem Printing using IWebBrowser2 from IWAM Account on Server 2003
    ... The LoadUserProfile API will take an Handle object as input which represent ... of the account's logon session token for which you'd like to load the user ... | How can I run this for the IWAM account if I do not know its password? ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Transaction Oriented Architecture (TOA)
    ... Given embedded SQL mapping an account /thing/ to the DB as: ... then the SQL is dependent on: an account table/view, its columns, and the explicit reference to accountKey. ... Procedure names and their arguments should be considered as an API to the DB's solution domain. ... this kind of interface is common among object oriented languages and isn't a foreign concept to OO programmers. ...
    (comp.object)
  • Re: Encapsulating and Securing Pre-canned ADSI calls
    ... The OS will protect the credentials ... You could also set up the process account to use a specific admin identity ... Your business logic security layer ... > 1) Have the API obtain credentials of the user with admin rights in AD, ...
    (microsoft.public.dotnet.security)
  • Re: ( picoVerse-:( Smalltalk based Automated Trading Systems ) )
    ... other brokers with an API but they don't allow non-US residents ... TradeStation has an automated trading facility ... we use Interactive Brokers. ... We have been running one account for three years and over that time ...
    (comp.lang.smalltalk.dolphin)
  • Single-sign-on .NET GUI to J2EE server
    ... talk to the AD api and say "give me the current logon session id" ... pass the user and the result from 1) over to J2EE ... Thanks and sorry for the long-drawn post. ...
    (microsoft.public.dotnet.security)