I'm having a problem with threading (permissions?) in a VB.net
Windows application (background service). I'm trying to write an
application that processes files, launching a new thread for each file
that is dropped into a certain folder. Now, the application works like
a charm on my Win2000 machine, but when I moved it to the Win2000
server, where it will eventually need to run, it fails. One of the
processes that is run on the file is a process to decrypt the file, and
this is the only process that won't work on the server. Since there
is no debugger on the server, I just stripped down the application, so
I could find where the problem is. It turns out that the decryption
process will work on the server if I call the method directly. But, if
I instantiate a child thread to handle the file, and that thread calls
the decryption process, then the application fails. A funny thing is
that if I put a Msgbox in the middle of the decryption process and
click the OK button when it pops up, then the process works fine, even
with the instantiation. Too bad I don't want the Msgbox.
Anyway, here's an edited version of the stripped-down code:
Public Module DecryptTestPare nt
Public Sub Main()
'''''' Version 1: Direct Call - This works fine ''''''
'Dim dtCh As New DecryptTestChil d()
'dtCh.DoDecrypt ()
''''''''''''''' ''''''''''''''' *'''''''''''''' ''''''''''
'''' Version 2: Instantiation - This doesn't work ''''
Dim dtCh As New DecryptTestChil d()
Dim pThread As New System.Threadin g.Thread( _
New System.Threadin g.ThreadStart(A *ddressOf
dtCh.DoDecrypt) )
pThread.Start()
' Just to make sure parent doesn't somehow strand child
While pThread.IsAlive : End While
''''''''''''''' ''''''''''''''' *'''''''''''''' ''''''''''
End Sub
End Module
Public Class DecryptTestChil d
Public Sub DoDecrypt()
Dim ReturnObject As Object = fctDecryption( _
"..\..\Files_Re pository\Encryp *tedFile.sur")
If Not IsError(ReturnO bject) Then
MsgBox(ReturnOb ject.ToString)
Else : MsgBox(ReturnOb ject.Message.To *String())
End If
End Sub
Public Function fctDecryption(B yVal FileName As String) As Object
' This method has been editted for privacy and simplicity.
' Just know that it eventually calls a 3rd-party decryption
' module in order to decrypt the file.
Return DecryptedString OrException
End Function
End Class
Now it's likely that the 3rd-party decryption class creates,
accesses, or deletes temporary files and accesses private information
for somewhere, and it's failing on the server because it doesn't
have permission to do so. Is that right? Is there some issue with
child threads not having the same permissions as the parent? Is there
something that I can do about that? I tried setting the parent
thread's CurrentPrincipa l to the child's CurrentPrincipa l, but it
didn't help. Maybe I wasn't doing it properly, though.
Any help?
Thanks. 0 993 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lkrubner |
last post by:
I want to give users the power to edit files from an easy interface, so
I create a form and a PHP script called "fileUpdate". It does a
reasonable about of error checking and prints out some errors. It uses
fileperms() to get the permissions of the file, and it includes that
info in any error message. Today I'm getting the following error
message. I've used SmartFtp to go in and set the test file's
permissions to 777, but in this error...
|
by: Dave |
last post by:
I have a C# application that I want to run as a "smart client", by executing
the exe through IE pointing to an intranet server. I need to increase
permissions to the application because it accesses a local SQL server, and
the Intranet zone by default doesn't have rights to do this
(SqlClientPermission).
So, I assigned FullTrust to the URL that points to my app through the .NET
configuration tool. Everything was working fine until I...
|
by: mareal |
last post by:
I have noticed how the thread I created just stops running. I have added
several exceptions to the thread
System.Threading.SynchronizationLockException
System.Threading.ThreadAbortException
System.Threading.ThreadInterruptedException
System.Threading.ThreadStateException
to see if I could get more information about why the thread stops running
but that code is never executed. Any ideas on how I can debug this?
|
by: alex444 |
last post by:
Hi all,
I'm getting the following exception when trying to open an Access DB from
the new thread:
The Microsoft Jet database engine cannot open the file
'\\path\errorLog.mdb'. It is already opened exclusively by another user, or
you need permission to view its data.
The point is that the main thread can access that file no trouble at all
(hence it's coded that only a spawned thread should do this).
|
by: Brian |
last post by:
I have an file based asp.net application the creates a thread to do some
background printing. It works fine but when the application is deployed on a
web server, the following error occurs in the thread when it accesses SQL:
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.
Note the blank user. It seems that the new thread does not have the
credentials but looking at "Thread.CurrentPrincipal",...
| |
by: Matt |
last post by:
I've written a class that allows me to add documents to a SharePoint
Document Library from another web application. The web app runs under
a domain account that has permissions to SharePoint. However, when I
try to do this from a background thread it fails with Access Denied.
I've tested the WindowsIdentity from the background thread and it is
the same. Are background threads not running in the same security
context under ASP.NET 2.0? ...
|
by: palepimp |
last post by:
Hello all,
I have searched far and wide for a solution to my issue. In short, here is the problem:
1. 3 PC's enter data into an Access 2003 database (PC's are running Vista w/ Office 2007 pro). The database has been used for a long time and we haven't upgraded it to a 2007 version database.
2. One of the PC's hosts the "master" database, the 2 others are using Replica's of "master" database. At the end of each work day, the...
|
by: eclipsme |
last post by:
I thought I had this licked, but apparently not.
I have a file upload script that attempts to upload a file to a
directory in the public_html directory - www.domain.com/upload
The permissions for the directory have to be 777 for this to work or
esle it aborts with a permissions error - obviously a problem. The php
script runs as user 'nobody'.
Tech support is through email, and level one is not that bright, or at
|
by: sandromani |
last post by:
Hello,
I am working at a webbased file browser, where users will be able to access, rename, delete, etc files and folders. My question is, what is the best way to handle permissions / authentication with apache in a *nix environment? Basically what I am searching for is something that works roughly the same as the windows integrated authentication, where the commands executed on server-side are executed as the user with witch the session was...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 project—planning, coding, testing, and deployment—without 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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
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...
| |