|
What account is this service running under?? If it's the LocalSystem account, it doesn't have any access to network resources, so it can't map drives to network shares and can't use UNC paths to get to them either.
There is no difference between Shell and Process.Start. They do the exact same thing using the exact same Win32 API's to do their work. Shell is outdated and not guaranteed to be there in future versions of VB.NET. It's only there for backwards compatibility with VB6 code.
You service needs to be running under an account that has permissions to the network resources you're talking about in order to work properly.
Is this "D:" drive a local drive to the workstation running the service?? Or is it a mapped drive to a network share?? If so, is there a login script that maps this drive when the user logs in??
|
|
|
|
|
> What account is this service running under??
Network logon we use for these type of applications with administrative privileges and access to all the network locations I'm trying to reach. This is also the network login I use to sign onto the server and setup scheduled tasks, etc.
> Shell is outdated and not guaranteed to be there in future versions of VB.NET. It's only there for
> backwards compatibility with VB6 code.
That is what I thought. I don't want to write code that is not guaranteed to work in the next release and forward if I can help it.
> You service needs to be running under an account that has permissions to the network resources
> you're talking about in order to work properly.
I can run the application from the server signed on with the same credentials and it works like a charm.
> Is this "D:" drive a local drive to the workstation running the service?? Or is it a mapped drive
> to a network share?? If so, is there a login script that maps this drive when the user logs in??
The D: drive is a local second hard drive on the server. If I locate the application on this drive and have the service start it, everything works fine. If I keep it on the other server where it should be, I can start it manually, but the service doesn't want to fire it off.
Lost in the vast sea of .NET
|
|
|
|
|
Was this second .EXE written under .NET (C#, VB.NET)??
If so, then you're running into the Code Access Security problem where code running from a network source is not trusted. You have to tell the .NET CLR on the machine running the code to trust the network location the code is stored on or sign the code and tell it to trust code signed with a ceratin certificate.
|
|
|
|
|
> Was this second .EXE written under .NET (C#, VB.NET)??
Yes
> If so, then you're running into the Code Access Security problem where code running from a network
> source is not trusted. You have to tell the .NET CLR on the machine running the code to trust the
> network location the code is stored on or sign the code and tell it to trust code signed with a
> ceratin certificate.
I'm going to look into this. I've seen this problem in the past and we even have a MSI file that we created to set security on workstations. I'm going to review our documentation and tweak the server with these settings and see if it helps.
Thanks!
Lost in the vast sea of .NET
|
|
|
|
|
Just remember, you have to tweak the machine that's going to be running the code, not the server where it's stored.
|
|
|
|
|
The code running is on a server and the service calling the code is on another server. Both servers are set to full trust on the code access settings for intranet in the 1.1 configuration tool found in administrative tools.
Unfortunately both apps (Service and code we're running are 2005 framework 2.0). Where do we find the configuration tool for 2.0. The framework is loaded, but the tool is not there. Is it a seperate install or is it a different process entirely?
Thanks for all your help. I believe this is definitely the issue. I'm heading out for the day, but will check for a reply if you have a chance in the remainder of the day to reply.
Thanks again!
Lost in the vast sea of .NET
|
|
|
|
|
Get the Dot Net 2.0 SDK and use mscorcfg.msc in the run window.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
I installed the Framework 2.0 SDK on the server, went to administrative tools, configuration tool for framework 2.0 and moved the Code Access Security for the Intranet Zone to Full Trust.
Restarted my service and it worked without a hitch.
Thanks for all your help!
Lost in the vast sea of .NET
|
|
|
|
|
Thanks for all your help! The code access security change worked!
Lost in the vast sea of .NET
|
|
|
|
|
One problem may be that the server process which tries to execute the program is running on different credentials (for example under local system) than what you used when you tested starting the program.
Also catch all exceptions and write them to a log or whereever it's easy for you to check if the call failed.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I agree with catching all exceptions and the service is processing the code. Nothing fires however. I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path. It bailed and was caught by the try/catch logic.
Like I said the credentials for the service firing off the executable is using a network credential with administrative privileges.
The shell logic which was the first reply seems to work but I'm not sure why the process.start logic doesn't.
Any other suggestions are appreciated.
Lost in the vast sea of .NET
|
|
|
|
|
I would try this. Create a new generic win app to test with. Use the following overloaded version of the process.start method.
Public Shared Function Process.Start ( _
fileName As String, _
userName As String, _
password As SecureString, _
domain As String _
) As Process
Get it to work from the generic app and then change your service as needed. Services can be hard to debug. Ensure when the service is installed that the credentials on the service are correct as well (right click the service in the control panel and change as needed).
If push came to shove, you could call something like CreateProcessWithLogon or do the generic shell:
Declare Function CreateProcessWithLogon Lib "advapi32" Alias "CreateProcessWithLogonW"
If someone wants to ding me on the score fine, just let me know why. Thanks.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
modified on Thursday, October 23, 2008 2:29 PM
|
|
|
|
|
KreativeKai wrote: I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path.
This is because any mapping you make is specific to your logon session. Any other session using the same credentials will not see any drive you map. That's why I asked if the drive is mapped from a login script. Services run under their own login session and under an entirely different desktop. They (normally) have no idea, nor should they even care, if a user is logged on or not.
|
|
|
|
|
Instead of directly starting the exe, try to use ProcessInfo class. Especially following properties may be helpful:
- Domain
- ErrorDialog
- FileName
- LoadUserProfile
- RedirectStandardError/Output
- Username/Password
- WorkingDirectory
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Thanks for your help! The problem turned out to be linked to security. Thanks again!
Lost in the vast sea of .NET
|
|
|
|
|
No problem
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Is it possible to do a dataview.Sort with part of a column? I have a datatable with 4 columns. I need to sort off the first column, but only off the first 4 characters, like this:
ORDER BY LEFT(ScheduleID,4) DESC
The above order by is valid in SQL, but doesn't appear to work in the dataview.sort using "LEFT(ScheduleID,4) DESC". Of course "ScheduleID DESC" works, but I don't get the desired results.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
No, it's not. You'd have to split the values in that column into another column with just the data that's valid for the sort, then sort on this column.
But, as you've found out, it's easier to do on the database side, and it'll have far better performance too.
|
|
|
|
|
Unfortunately, I'm building the datagridview rows from reading in a text file.
Your idea about adding a hidden sort column is brilliant!
Thanks Dave.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
I am having trouble finding documentation on how to, using Vb.net to read a png file into a string and convert to Hex.
Dow anyone have any code examples for me? Thank you
|
|
|
|
|
What do you mean by "reading a png file into a string and convert to Hex"??
Any file is just a stream of byte values, 0x00 thru 0xFF. Converting those to Hex is as easy as using String.Format("{0:X2}", value) to return a single value as a Hex string. What you do with those strings is up to you.
|
|
|
|
|
I am reading the png like this. (I don't know if this is the best way.
Dim ascii() As Byte = File.ReadAllBytes("C:\3604.png")
I want to put This into a string.
dim str as string = String.Format("{0:X2}", ascii) Does not work.
Is there an easy way besides looping through each byte and copying it to string?
|
|
|
|
|
Cory Kimble wrote: dim str as string = String.Format("{0:X2}", ascii) Does not work.
Sure it does, when you convert each and every byte in the array, individually. You can't send an array to Format and expect it to iterate over the array for you.
Cory Kimble wrote: Is there an easy way besides looping through each byte and copying it to string?
Nope. That's the only method you have.
|
|
|
|
|
Hi,
I wotre years ago in vb6 a database for music. I want to convert the whole program into VB.net 2008.
The original program was with cddb from gracenote.
The question now is is there support for .net by gracenote or is there something beter/easyer but with the same functions?
Like seeing what cds is in the drive, editing mp3 tags
If posible also support for DVD(music/films/series)
Jan
some examples from the new system are welcome
|
|
|
|
|
There's a GPL service called FreeDB[^] now.
|
|
|
|