|
If you're file doesn't exist, then either you hap-hazardly hard-coded the file path (never a good idea) or it doesn't exist in the directory you think it should.
Typically, in .NET Remoting you just use the application's .config file (in the same directory as the application with the same name + .config appended, like an app called MyApp.exe would have a file called MyApp.exe.config in the same directory) and then you'd call RemotingConfiguration.Configure passing the AppDomain.CurrentDomain.SetupInformation.ConfigurationFile so that you can keep everything in the same .config file. This is true for both the client and server. If you don't want to do it this way, then you need to code your app so that it can find the file no matter where it is, like using Application.StartupPath in the client application to use the directory where the .exe is located, and then use Path.Combine to combine that with file.config using the platform-dependent directory separator character.
To debug your application, just click the Debug->Start menu. There is more information in the Visual Studio help.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
ok thanks a lot.
The error is a nullexecption in my client.
Now all are working.
Best Regards
youssef
|
|
|
|
|
How can I make it so that only one instance of my application is allowed to be run at a time. For example, Windows Media Player will only open once.
|
|
|
|
|
You can use a Mutex to limit your application to only one instances like so:
public class SingleInstanceApp
{
private const string UniqueId = "SingleInstanceApp_Mutex";
static void Main()
{
Mutex m = new Mutex(false, UniqueId);
if (m.WaitOne(0, true))
{
Console.WriteLine("I'm the first instance!");
Thread.Sleep(10000);
}
else
{
Console.WriteLine("I'm not the first instance. :(");
}
}
} If you want to, for example, open a document passed to the command line of the second (or later) instance, you'll need to use inter-process communications. In .NET, the preferred way is using .NET Remoting.
There is a good article here on CodeProject about this entitled Single Instance Application in VB.NET
[^]. It's in VB.NET but if you truly understand the .NET Framework, it should be no problem to translate. Supposedly, there are a few implementations based on this article in C# but the articles explain almost nothing. I guess you're supposed to just look at their source, which I didn't feel inclined to do.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for the response Heath.
|
|
|
|
|
Heath Stewart wrote:
Console.WriteLine("I'm not the first instance. ");
You realize the unimpressed face won't show up in the console??
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hello,
I want the tab label to change appearance when the mouse passes over it.
I tried using OnMouseEnter of the tab control and I can get the appropriate tab label to change based on GetTabRect and the mouse position, but after the tab changes, since the mouse is still in the visible portion of the tab control, I cannot do the same for another tab unless I explicitly leave the tab control with the mouse and enter on top of the next tab.
I want to be able to run my mouse across all of the tab labels and have them, for example, turn red only when the mouse is over them.
Any suggestions?
Thanx,
-Flack
|
|
|
|
|
Tab controls support hot tracking (TCS_HOTTRACK style) by default, but that will turn a tab label to a blue color instead of a red.
Gurmeet BTW, can Google help me search my lost pajamas?
My Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I am very impressed with DonNetScriptEngine. However, I would like to suggest a more robust deployment.
1. Adding the object to the Task Bar Notification Area.
2. Enable the console if need or selected in the dnml file.
Also, Is it alright to incorporate this object into my own DotNet programs?
Thank you.
|
|
|
|
|
You should post a thread in the article you are refering to, the auther will be sent an email with your thread. You will have better luck this way.
- Nick Parker My Blog | My Articles
|
|
|
|
|
To what article are you referrning?
Q:What does the derived class in C# tell to it's parent?
A:All your base are belong to us!
|
|
|
|
|
How can i enter lots of data ( like array and matrix ) in windows form. e.g. If i must enter 2,7,2,9,1,6,3,0,12,45,3 ( i could do it in console application, but i need to do it in windows form )
|
|
|
|
|
Could you be more specific? Are you trying to enter this data into a control on the form, as the arguments passed to the form, etc?
---------------------------
He who knows that enough is enough will always have enough.
-Lao Tsu
|
|
|
|
|
I am trying to enter this data into one field on the form, but it would be also very useful if i would know how to use this as arguments passed into form. And how would this form look like? I think that if i would enter this array in textbox it would be not very smart.
|
|
|
|
|
Hi all,
I wrote a simple ASP.NET Web Services as follow:
<br />
[WebMethod(EnableSession =true)] <br />
public bool Login(string username, string password) <br />
{ <br />
Session["userid"]=username; <br />
<br />
return true; <br />
} <br />
<br />
public string WhoAmI() <br />
{ <br />
return (string) Session["userid"]; <br />
}
Then I wrote a simple Windows form with 2 textboxs for username and password, 2 buttons for the function Login and WhoAmI. The code looks like following
<br />
public class Form() <br />
{ <br />
<br />
private MyWebServices m_proxy = new MyWebServices; <br />
<br />
<br />
<br />
<br />
public void Login_click (object sender, EventArg eventArg) <br />
{ <br />
m_proxy.CookieContainer = new System.Net.CookieContainer(); <br />
if (m_proxy.Login()) <br />
{ <br />
MessageBox.Show("Login Success"); <br />
} <br />
else <br />
MessageBox.Show("Login Fail"); <br />
<br />
} <br />
<br />
public void WhoAmI_click(object sender, EventArg eventArg) <br />
{ <br />
MessageBox.Show("Hello, you are "+m_proxy.WhoAmI()); <br />
} <br />
<br />
}
The problem is that, when I open more than 10 clients, and click on button Login on each Windows Form client (with different username and password), the 11th client throws an exception with HTTP Error 403 code: Access forbidden.
This means that my Web Services can not be accessed by more than 10 clients at a time. This really stupid, but I don't know why, and how to solve this problem.
Any help will be appreciated.
|
|
|
|
|
Is your service running on a Windows XP or 2000 Pro or NT4 Workstation? If so, your machine is limited to 10 outside connections by it's license. Server versions of the OS will allow more connections.
RageInTheMachine9532
|
|
|
|
|
|
Think about it...If everyone had a server under their desk able to support 1,000+ connections there wouldn't be any reason to sell Windows Server for the price it's going for.
RageInTheMachine9532
|
|
|
|
|
If you're running a small website, there are some solutions which will allow you to deploy ASP.NET running under Apache.
With this, you can overcome this license limits without needing to resort to a server OS.
But if your intent is stress-testing, you will only be able to do it on W2K or W2K3.
Due to technical difficulties my previous signature, "I see dumb people" will be off until further notice. Too many people were thinking I was talking about them...
|
|
|
|
|
Oh! You mean, like the old ChiliSoft stuff which would allow you to run ASP pages even on Unix. I misunderstood the previous post to mean that the OS would only allow ten inbound connections. I'm not so hot and bothered if it's just IIS.
Chalk me up as a dumb person.
Regards,
Jeff Varszegi
EEEP! An Extensible Expression Evaluation Package
|
|
|
|
|
The connection limit refers to the number of redirector-based connections and is enforced for any file, print, named pipe, or mail slot session. The TCP connection limit is not enforced, but it may be bound by legal agreement to not permit more than 10 clients.
The maximum number of inbound connections allowed by XP Pro is 10. The max allowed by XP Home is 5... Of sourse, a couple modifications can be made to (kind of) get around this limit. Like disabling HTTP keep-alives for the site...
Want proof? See this[^] article in the IIS Support Base...
RageInTheMachine9532
|
|
|
|
|
Dave Kreskowiak wrote:
Is your service running on a Windows XP or 2000 Pro or NT4 Workstation?
XP SP1 nicely limits this to 2 connections, and hence makes debugging an ASP.NET impossible...
|
|
|
|
|
Something else is wrong then, because I'm also running XP SP1 as a development machine without any problems testing up to 5 connections at once. After that, it gets transferred to the production Win2K3 Server.
RageInTheMachine9532
|
|
|
|
|
I dunno what it was then, but the problem happened straight after installing SP1. My solution: install Apache 1.3
|
|
|
|
|
I don't think Windows licence is the problem. My friend uses a Windows 2000 Pro, and he's written an ASP.NET XML Web Services that accept more than 10 connections (I've seen that 20 connections is OK).
|
|
|
|