Click here to Skip to main content
16,005,467 members
Home / Discussions / C#
   

C#

 
Questionhow to locate an accurate position in the vectorgraph in C# Pin
greatsft19-Jun-05 22:06
greatsft19-Jun-05 22:06 
GeneralC# remoting Pin
khoadang19-Jun-05 21:37
khoadang19-Jun-05 21:37 
GeneralRe: C# remoting Pin
S. Senthil Kumar19-Jun-05 21:56
S. Senthil Kumar19-Jun-05 21:56 
GeneralSearch file that contains text Pin
wolfganggoldner19-Jun-05 21:02
wolfganggoldner19-Jun-05 21:02 
Generalweb page with crystal report failed when I run in .net 1.1 Pin
dabuskol19-Jun-05 20:51
dabuskol19-Jun-05 20:51 
GeneralControl library reference not updated in web project Pin
mihir7719-Jun-05 20:37
sussmihir7719-Jun-05 20:37 
GeneralRe: Control library reference not updated in web project Pin
Dave Kreskowiak20-Jun-05 4:29
mveDave Kreskowiak20-Jun-05 4:29 
GeneralC# Remoting Pin
jdkulkarni19-Jun-05 20:21
jdkulkarni19-Jun-05 20:21 
Can anybody tell me that, if i'm using .NET remoting server with SAO, how can i raise an event across different application domains? the application wors fine when on the same machine but creates problem when I try using server and client on different machine.
The error description and stack trace is:
I tried with microsoft solution which says that u create an abstract class and override it in client and handle events there. But it does not work for me.

Here is the error:
Exception occured at server. Message:
Server encountered an internal error. For more information, turn on customError
s in the server's .config file.
Stack trace:

Server stack trace:


Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at Coordinator.RemotableDelegate.WelComeMessage(ChatArgs ca) in E:\Jayant\Pra
ctice\MyChatArchitecture\Coordinator\IMediator.cs:line 139
at MarshalByRefClass.Mediator.ConnectMe(String userName) in E:\Jayant\Practic
e\MyChatArchitecture\MarshalByRefClass\Mediator.cs:line 49



I'm not using any App.config file. My server code is as follows.

// For Http channel
try
{
SoapClientFormatterSinkProvider scl = null;
SoapServerFormatterSinkProvider ssr = new SoapServerFormatterSinkProvider();
ssr.TypeFilterLevel = TypeFilterLevel.Full;

IWebProxy proxy = new WebProxy("proxy.sharda.mahindrabt.com", 80);
ICredentials ic = new NetworkCredential("myself", "123");
proxy.Credentials = ic;

IDictionary id = new Hashtable();
id["port"] = 9113;
id["typeFilterLevel"] = TypeFilterLevel.Full;
id["name"] = System.Guid.NewGuid().ToString();

id["proxyName"] = "proxy.sharda.mahindrabt.com";
id["proxyPort"] = 80;
id["machineName"] = "DSCP01214Jayant";
id["credentials"] = ic;
id["unsafeAuthenticatedConnectionSharing"] = true;
HttpChannel htc = new HttpChannel(id, scl, ssr);
ChannelServices.RegisterChannel(htc);

RemotingConfiguration.RegisterWellKnownServiceType(typeof (Mediator), "Chat.soap", WellKnownObjectMode.Singleton);
Console.WriteLine("Server running at Http port: 9113 and Tcp port: 5678");



Client code:
uname = "myself";
pwd = "123";
SoapClientFormatterSinkProvider scl = new SoapClientFormatterSinkProvider();
SoapServerFormatterSinkProvider ssr = new SoapServerFormatterSinkProvider();
ssr.TypeFilterLevel = TypeFilterLevel.Full;

IWebProxy proxy = new WebProxy("proxy.sharda.mahindrabt.com", 80);

if (txtProxyUserName.Text == string.Empty ||
txtProxyPassword.Text == string.Empty)
{
ic = new NetworkCredential(uname, pwd);
}
else
{
ic = new NetworkCredential(txtProxyUserName.Text,
txtProxyPassword.Text);
}
proxy.Credentials = ic;

id = new Hashtable();
id["port"] = 0;
id["typeFilterLevel"] = TypeFilterLevel.Full;
id["name"] = System.Guid.NewGuid().ToString();
id["preauthenticate"] = true;
id["proxyName"] = "proxy.sharda.mahindrabt.com";
id["proxyPort"] = 80;
id["machineName"] = "DSCP01214Jayant";
id["credentials"] = ic;
id["unsafeAuthenticatedConnectionSharing"] = true;

HttpChannel htc = new HttpChannel(id, scl, ssr);
ChannelServices.RegisterChannel(htc);
this.SetChannelProxy(htc, proxy);

im = (IMediator) Activator.GetObject(typeof (IMediator), "http://localhost:9113/Chat.soap");

result = true;
}
catch (Exception ex)
{
result = false;
stsConnected.Text = string.Empty;
stsConnected.Text = "An error occured. Message: " + ex.Message;
lblErrorMessage.Text = "An error occurred: " + ex.Message;
}
finally
{
}
return result;
}

private void SetChannelProxy( HttpChannel channel, IWebProxy proxy )
{
//get the channel data
FieldInfo clientChannelFieldInfo = typeof(HttpChannel).GetField("_clientChannel", BindingFlags.Instance | BindingFlags.NonPublic);


//cast it to httpclientchannel to get an access to IWebProxy Class.
HttpClientChannel clientChannel = (HttpClientChannel) clientChannelFieldInfo.GetValue(channel);


//get Proxy object
FieldInfo proxyObjectFieldInfo = typeof(HttpClientChannel).GetField("_proxyObject", BindingFlags.Instance | BindingFlags.NonPublic);


//set up proxy explicitly.
proxyObjectFieldInfo.SetValue(clientChannel, proxy );
}


Jayant D. Kulkarni
Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
GeneralFileSystemWatcher Pin
Vikram Sharma19-Jun-05 20:19
Vikram Sharma19-Jun-05 20:19 
GeneralRe: FileSystemWatcher Pin
Dave Kreskowiak20-Jun-05 4:24
mveDave Kreskowiak20-Jun-05 4:24 
GeneralRe: FileSystemWatcher Pin
Vikram Sharma20-Jun-05 7:48
Vikram Sharma20-Jun-05 7:48 
GeneralRe: FileSystemWatcher Pin
Dave Kreskowiak20-Jun-05 9:26
mveDave Kreskowiak20-Jun-05 9:26 
GeneralStreamReader Pin
StephenMcAllister19-Jun-05 19:55
StephenMcAllister19-Jun-05 19:55 
GeneralRe: StreamReader Pin
Christian Graus19-Jun-05 19:57
protectorChristian Graus19-Jun-05 19:57 
GeneralRe: StreamReader Pin
MoustafaS19-Jun-05 23:26
MoustafaS19-Jun-05 23:26 
QuestionDisplay an MDI Child Form in Show in Modal Form ? Pin
kakarato19-Jun-05 19:05
kakarato19-Jun-05 19:05 
AnswerRe: Display an MDI Child Form in Show in Modal Form ? Pin
Dave Kreskowiak20-Jun-05 4:20
mveDave Kreskowiak20-Jun-05 4:20 
GeneralRe: Display an MDI Child Form in Show in Modal Form ? Pin
kakarato21-Jun-05 0:36
kakarato21-Jun-05 0:36 
GeneralExcel automation and defining a Name for Excel sheet Pin
dgap19-Jun-05 16:51
dgap19-Jun-05 16:51 
GeneralDistribuiting my .NET application to XP users Pin
Sasuko19-Jun-05 13:56
Sasuko19-Jun-05 13:56 
GeneralRe: Distribuiting my .NET application to XP users Pin
Christian Graus19-Jun-05 20:00
protectorChristian Graus19-Jun-05 20:00 
GeneralRe: Distribuiting my .NET application to XP users Pin
Anonymous19-Jun-05 22:45
Anonymous19-Jun-05 22:45 
GeneralRe: Distribuiting my .NET application to XP users Pin
ekynox17-May-06 15:37
ekynox17-May-06 15:37 
GeneralEmbed resources programmaticly Pin
ricny04619-Jun-05 13:17
ricny04619-Jun-05 13:17 
GeneralRe: Embed resources programmaticly Pin
Dave Kreskowiak20-Jun-05 4:15
mveDave Kreskowiak20-Jun-05 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.