|
Thanks for the input. Have a good weekend.
|
|
|
|
|
No worries mate, you too.
|
|
|
|
|
I'm working on a WCF service project that creates a listener thread for TCP messages, and everything appears to work just fine except for shutting down the service. Here's a simple example that illustrates the problem:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single,ConcurrencyMode=ConcurrencyMode.Multiple)]
public class Service1 : IService1, IDisposable
{
private void ThreadFn()
{
bool b = true;
while(b)
{
//do something
Thread.Sleep(1000);
}
}
private Thread m_Thread;
public Service1()
{
m_Thread = new Thread(new ThreadStart(this.ThreadFn));
m_Thread.Start();
}
public void Dispose()
{
m_Thread.Abort();
}
~Service1()
{
Dispose();
}
}
As you can see, this is a singleton service that creates a thread when the host starts, and kills the thread when the service is disposed. Unfortunately, there does not seem to be any way to reliably detect when a service is unloaded by the host. I've tried binding to the AppDomain.Unload and AppDomain.HostProcessExit events, however if Visual Studio hosts the service, these events are never fired. I've also tried creating a custom IInstanceProvider, but this only tells me when a method invocation is performed, and even then only when the InstanceContextMode is changed from Single. I want to be able to move the service into different hosting frameworks, so I'd like a solution that is an generic as possible. Does anyone have any suggestions?
Thanks,
Chris
|
|
|
|
|
I would like to compile my vb.net 2005 solution using MSBuild. I am running the command on the solution (.sln) file and it runs without errors, unfortunately it doesn't seem to be compiling the setup/deployment projects which are part of the solution, one is a merge module whilst the other is a windows deployment project. What can i do to make msbuild work for me?
Your assistance is greatly appreciated.
|
|
|
|
|
MSBuild doesn't know how to build VS deployment projects. Upgrading to VS2008 won't help you either. The only option is to run VS through the command line with the appropriate switches. In your command prompt (assuming VS is in your path), run "devenv.exe /?" for the list of switches.
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
I feel I am going in circles with this one. I have seen various posts on
this matter but I can not get them to work. I have a 2.0 client app that
needs to access a web service secured behind an apache server that requires
client certificates. I have tried
webService.ClientCertificates.Add(new X509Certificate("c:\\temp\\xxx.cer",
"password"));
with various variations of certificates, formats, etc. I always get "The
request was aborted: Could not create SSL/TLS secure channel." But...if I
import the certificate using Internet Explorer everythings works just fine.
I just can't get it to work by adding the client certificates at runtime.
Whats the trick to get it to work without importing the certificate into a
store?
|
|
|
|
|
JoeJoe101 wrote: Whats the trick to get it to work without importing the certificate into a
store?
Check this out[^]
led mike
|
|
|
|
|
|
It's been a long time, but it's probably best to follow Microsoft's step-by-step[^] guide.
This[^] is also useful.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hello!
I have a TCP/IP-Server, that listens for connections from a electronic device.
The device connects to the server and the server build another IP-Connection to the electronic.
It may happen, that the electronic has to reboot and cannot close the connection properly.
The server has a connection-watchdog, that checks when the last message came in from the electronic and tries to close the connection if the electronic didn´t send a message since a certain time.
Since the electronic cannot answer this close-request the connection seems to remain open, at least that´s what "netstat" tells me ("Wait for FIN", or "Last message was ACK").
Also it may happen, that the electronic tries to connect again, but then the server send´s just an "ACK" instead of "SYN/ACK", what makes the electronic retry to open the connection with "SYN". (Traced with WireShark)
Is there a way to force the closing the connection, clear the open/waiting ports and enable the server to accept a new connection from the same electronic on the same port from the same IP?
Thanks
J.
|
|
|
|
|
Yikes. No way to configure the device to use something easier like UDP?
Going to be a massive pain to hook that deep into the network stack :/
|
|
|
|
|
Unfortunately not. We do not have access to the electronic´s firmware, so we cannot change the protocol in any way...
|
|
|
|
|
J. Holzer wrote: the server build another IP-Connection
Have you looked at the documentation for Winsock2[^]? Things like calling setsockopt for SO_KEEPALIVE can return errors when the connection is down.
led mike
|
|
|
|
|
I have a COM callable assembly, that when registered using a Setup project, does not appear in the COM References list in .NET, nor does it appear in the References list in the MS Access VBA Reference list. However, I can create and use the object using CreateObject in VBA.
What could be wrong here?
|
|
|
|
|
Brady Kelly wrote: What could be wrong here?
Could be that registering a component in COM does not make it appear in the lists provided by any particular software, like MS Access. Could be you have to tell Access to add the component to it's list.
led mike
|
|
|
|
|
No. On previous occasions only registering the component was required. VS also lists all nearly all registered COM servers.
|
|
|
|
|
Brady Kelly wrote: No.
Ok. If that's true then another obvious "could be" is the setup is not creating a piece of meta data that is used to build those lists.
Brady Kelly wrote: VS also lists all nearly all registered COM servers.
"nearly all"? Do you mean all but yours, the one you are interested in or are there others not listed as well?
led mike
|
|
|
|
|
led mike wrote: Ok. If that's true then another obvious "could be" is the setup is not creating a piece of meta data that is used to build those lists.
Yes, and it is this that I am at a loss to begin to diagnose. It's too low a priority tonight, as the library can still be used, but I'll definitely really look deeply into it tomorrow. If it wasn't for a birthday party on Saturday it could even end up a whole weekend mission.
led mike wrote: "nearly all"? Do you mean all but yours, the one you are interested in or are there others not listed as well?
So far I've only encountered mine being missing, but it's been years since I authored any, or used many, COM components before this one. One I did earlier this week appeared in the lists.
|
|
|
|
|
I've been using the FtpWebRequest to download a lot of files via ftp..
However I've just added a new site to the list and I'm getting the following error
"The remote server returned an error: (550) File unavailable (e.g., file not found, no access)."
If I use the URI that I'm passing to the ftp webrequest in internet explorer it seems quite happy with it, the only difference I see between this site and others that I've used is the user name is in the form
username@online2.something.com
I can log in using the windows command line ftp client.
Can anyone tell me how to procede with investigating this problem ? have you seen anything similar?
Sean
|
|
|
|
|
Do you have access to the server logs? The server configuration? If it's Microsoft's IIS FTP server, setting the logging to include the Win32 status can also help give more information.
Failing that, can you get a trace of a working and a non-working session to the same server using a network trace tool such as Wireshark?
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks for this, I'm going to contact the company whose server it is, it is a VMS machine, I suspect that this is where the problems lies.
Sean
|
|
|
|
|
Apparently this is a known problem with the ftpwebrequest class, it doesn't work with VMS machines because of the style of directory listing, although it may be possible to switch the style of listing to RFC, which I'll try.
Microsoft are apparently going to fix this in a future release.
Sean
|
|
|
|
|
Hi all,
I'd asked my question but no answer...
Maybe its better:
I want to save some information in my host(http://loaclhost/)
What can I do?(suppose that my file is a config file, and I don't want
to save it in a database)
I am using .Net
thanks
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
don't cross post
led mike
|
|
|
|
|
First, a friendly gesture: This is my first forum question at codeproject! I have probably read hundreds of articles, and forum threads on CodeProject.com, and to tell you the truth, I find that other people have already asked all the right questions and there are already answers! I love codeproject.com for that!
The reason I am not finding answers is probably due to the fact that I am kicking the tires on something quite new--only available in Visual Studio 2008 with .Net 3.5 if I understand correctly.
Topic of my question: The Microsoft UI Automation Library
[^]
This MSDN article is dated, February 2008, and I can hardly wait until this stuff has been out in the wild longer--because there is little to no searchable resources other than MSDN documentation which is usually quite sparse in my experience.
My first 'hello world' UI automation experiment involves simply daisy-chaining two graphical UI applications on the desktop, referred to below as, extractApp and renameApp. I have all the source code available for extractApp--I wrote it, using C# on .Net 3.5 with Studio 2008. I did NOT write, and do not have access to the sourcecode of renameApp application. From what I can tell, it is a pure win32 app, definitely not a .Net app, and there is no (uncryptic) CLI.
Goal: Application extractApp finishes processing files in a folder, and I would like it to be able to "hand off" this folder (by object or string name) to the renameApp. There is no CLI available to use, however the renameApp does contain a control that supports a DragAndDrop operation. That is, if you drag a folder from an Explorer window, onto this "list1" control of the windows form for renameApp, it will respond to this DragAndDrop'ed folder name.
Side note: There is a ContextMenuHandler in the Windows registry for accomplishing this same "DragAndDrop" type of operation that was installed by this renameApp that I wouldn't mind figuring out how to be able to trigger programmatically from my extractApp as well. If you have any suggestions as to how I might programmatically execute a "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shellex\ContextMenuHandlers\{classid-string}" when there is no (known, published) verb implemented in the registry to use with ShellExecuteEx, or System.Diagnostics.Process.FileName="rundll32.exe shell32.dll,verb" + dirname" I'm all ears as well.
I couldn't figure out how to do this with the information at: http://msdn2.microsoft.com/en-us/library/bb776883.aspx[^] I gave up after discovering that there is this new and cool UI Automation namespace in .net 3.5 anyway...
Problem: I fairly quickly deciphered (from the new Feb. 2008 UI Automation MSDN article) how to get the handle of the control (in the renameApp) which needs to act as the target (or System.Windows.Automation.InvokePattern ??) of the DragAndDrop event triggered normally, by a user, using this short simple code:
Process renameCommandAppProcess = new Process();
renameCommandAppProcess.StartInfo = renameCommandApp;
renameCommandAppProcess.Start();
if (false == renameCommandAppProcess.WaitForInputIdle(10000))
{
MessageBox.Show("'renameApp' did not respond in a timely manner.", "Missing 'renameApp' application...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
}
else
{
IntPtr hrenameAppHandle = renameCommandAppProcess.MainWindowHandle;
if (hrenameAppHandle != IntPtr.Zero)
{
if (SetForegroundWindow(hrenameAppHandle))
{
AutomationElement aeForm = AutomationElement.FromHandle(hrenameAppHandle);
if (aeForm == null)
MessageBox.Show("'renameApp' did not hand over control in a timely manner.", "Missing 'renameApp' application?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
AutomationElement aeButton = aeForm.FindFirst(TreeScope.Children,
new PropertyCondition(AutomationElement.NameProperty, "List1"));
if (aeButton == null)
MessageBox.Show("'renameApp' did not hand over control: List1.", "Missing 'renameApp' application?", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
else
MessageBox.Show("'renameApp' found control: List1.", "Found it!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification);
}
}
}
By "16 patterns" I am referring to the table at the bottom of "Figure 6" of this article here:
http://www.codeproject.com/script/Forums/Edit.aspx?fid=1650&floc=/script/Forums/View.aspx[^]
Thankyou in advance for even taking the time to read this very lengthy post.
I apologize for any etiquette rules I overlooked in the FAQ.
-Phreud
|
|
|
|
|