|
We'll be happy to help. First, please let us know what you've tried and where you're having problems.
/ravi
|
|
|
|
|
On the windows form, we put listbox for the list of directories. A button to get the list of directories and display it on the listbox. Another button for downloading, and another button for uploading. We just need Asynchronous method when downloading or uploading a file or getting the list of directories.
|
|
|
|
|
Hi
I have a small project that would require me to convert a ASP Classic with 5000+ lines of code to ASP .NET C# is there such a tool that can do this for me? I've already research for the whole week but all the tools that I've tried didn't work. should I do a rewrite for the whole thing?
Thanks in advance.
|
|
|
|
|
I don't believe there is any tool that can do a full conversion for you.
There are a few that can help you convert parts of the program but honestly, you will have to do a large amount of conversion on your own.
|
|
|
|
|
Since ASP and ASP.NET are so vastly different, there is no conversion tool to go between the to. You have to rewrite this by hand.
|
|
|
|
|
I think the closest model to use is the Razor Web pages. If you try to use web forms or MVC, the change will be too much. Read about Razor web pages to learn about it.
|
|
|
|
|
Hi Guys,
I have a program that reads stuff from a Searial COM port. It uses one of those USB to COM port gizmos (Prolific driver).
The environment is Win7/Server 2008R2 (all 64 bit), joined to domain, .NET4.
The program works fine when run from within context of an end user.
However, when i try to run the same program as a windows service I get 'The system cannot find the file specified'. I tried to configure the service to run both as a local system account and as a domain service account (added to the admin ug), but still the same error.
I also created a little test program (see the code at the end of the post, it is stolen from somewhere on the internet).
This runs fine when run from the console and opens the port and reports its type (CHAR), but fails with the same error (File not found) when i try to run it as a scheduled job.
Again i tried running it both under my own account and under account of a service (both added as local admins) and it is the same error.
I am pretty sure it is some sort of a security/policy issue but cannot quite figure out what.
Any pointers will be greatly appreciated,
Alexei
static void Main(string[] args)
{
var portName = @"\\.\COM3";
var handle = CreateFile(portName, 0, 0, IntPtr.Zero, 3, 0x80, IntPtr.Zero);
if (handle == (IntPtr)(-1))
{
Console.WriteLine("Could not open " + portName + ": "
+ new Win32Exception().Message);
return;
}
var type = GetFileType(handle);
Console.WriteLine("File " + portName + " reports its type as: " + type);
}
[DllImport("kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall,
SetLastError = true)]
public static extern IntPtr CreateFile(
string lpFileName,
uint dwDesiredAccess,
uint dwShareMode,
IntPtr SecurityAttributes,
uint dwCreationDisposition,
uint dwFlagsAndAttributes,
IntPtr hTemplateFile);
[DllImport("kernel32.dll")]
static extern FileType GetFileType(IntPtr hFile);
enum FileType : uint
{
UNKNOWN = 0x0000,
DISK = 0x0001,
CHAR = 0x0002,
PIPE = 0x0003,
REMOTE = 0x8000,
}
|
|
|
|
|
Did you try configuring your service to run as a network account?
Why are you using CreateFile anyway? Can't you just open Com3 using the serial port class?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
No, I have not run it under network service account. I run it under local system account, which should have unrestricted access anyway.
CreateFile -- it is just a test program that illustrates the problem. The real service uses SerialPort class and behaves the same.
|
|
|
|
|
abshmak wrote: unrestricted access anyway
But not to network resources.
abshmak wrote: SerialPort class and behaves the same.
The serial port class give you a "File not found exception" also?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Wes Aday wrote: The serial port class give you a "File not found exception" also?
Yep, when run as a service or a scheduled task under an account that has local admin access.
Thanks
|
|
|
|
|
There are some strange differences between an interactive session and a service with the same user account. Last week, I had to find out that the environment variable %appdata% need not get resolved for the service.
Also look for batch files which are executed when a user logs in interactively.
|
|
|
|
|
Yep, i know. it is a non interactive service and has all the settings configured properly. It would be coming with a diff error anyway.
|
|
|
|
|
I see a problem. In the second parameter to CreateFile, you're not specifying any access rights.
You're supposed to request
GENERIC_READ | GENERIC_WRITE
Or in numbers:
0x80000000L | 0x40000000L
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I was going to try it, even though i did not think it would be an issue, as it should have behaved the same regardless of the account/mode it is run under. But then uncovered the solution.
|
|
|
|
|
Hi Guys,
I found the solution to my particlar issue, so posting it here in case it might help someone one day.
I am using an RS232 to USB cable. Supposedly it uses Prolific chipset.
Originally i installed the drivers supplied by the manufacturer. While trying to troubleshoot i installed the oficial prolific drivers which did not work, so i had to revert back to the initial drivers.
But, once this has been done, the things started to work:
- i no longer needed to run the program as elevated
- when run as a service the program is able to access the port
I suspect that this is some sort of a fault in the install package provided by the manufacturer, but i am going to leave it at that.
Regards,
Alexei
|
|
|
|
|
I am writing a C# 2010 console application that will have between 10 to 30 ways on how to run the application. The ways to run the application depends upon the parameter values that are supplied to the application. There a few ways to run the console application were the steps need to be completed successfully before the next step is executed.
I am trying to determine the best way to setup this application. Should I have the program determine how it should run by:
1. passing values to console application that will be run in the main method?
2. Should I use a database table that will be read to determine the way the program shoulld be executed on a particular run?
3. Is there an option using a windows service and/or scheduler?
4. Do you have any other options that will work?
Basically can you tell me what method you think would be the best and why? In adition can you tell me and/or point me to a reference that I can use to code your method of choice?
|
|
|
|
|
The easiest and most common way of doing this is to pass parameters to the program which are checked and validated in the main() method.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I have a C# 2010 console application that I am thinking of passing the parameter values to the application in the
applicationSettings><namspace.properties.settings> of the
consoleApp.exe.config file. I am thinking of using this option instead of passing argument values to the application.
What kind of code would I need to setup if I use this option? Would I look for args.length? Can you tell me what kind of code I would need to setup?
|
|
|
|
|
See here[^]. However this would be somewhat more complicated than my later suggestion.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi Everybody,
Last month I published a simulator solution for sending and receiving messages by C# on my laptop and made accedent and all my work lost, I tried to decompile my Simulator.exe file but get not sorted project and have many proplems, and can't modify it and it takes along time to redevelop it again
Is there a solution to decompile it as fast as possible ?
Best Wishes
|
|
|
|
|
Sounds like you have already decompiled it. Try a different decompiler and see if that gives you a better result.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
You're not going to get a full solution to build without errors, no matter what you use. MSIL is NOT a direct represnetation of the full source of your application, only an optimized approximation of it.
|
|
|
|
|
There is a program called reflector that is perhaps what you are looking for.
It is not free though.
|
|
|
|
|
See if you can find a debug/unoptimised version of your program. That way the IL will be the closest to the source code. However, you can never retrieve the exact source code from a compiled output. That's why source control and backups are important.
|
|
|
|