[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.remoting

Re: IIS hosting remote object

Ken Kolda

11/1/2004 4:32:00 PM

I don't see any obvious errors. I'd do as the error message suggests: turn
off custom errors so you can get detailed error information from the server.
For info on disabling custom errors, see:

http://msdn.microsoft.com/library/en-us/cpgenref/html/gngrfCustomerrorsS...

Ken


"Greg via .NET 247" <anonymous@dotnet247.com> wrote in message
news:O0Y8$C0vEHA.1264@TK2MSFTNGP12.phx.gbl...
> I have been successful using TCP protocol and a console exe for a host but
I can't get an IIS host version to work.
>
> I have a common DLL containing interfaces:
>
> namespace Common
> {
> public interface IClock
> {
> string WhatTimeIsIt();
> }
> }
>
> My remote object implements this interface:
>
> public class Clock : MarshalByRefObject, IClock
> {
> public Clock()
> {
> //
> // TODO: Add constructor logic here
> //
> }
>
> #region IClock Members
>
> public string WhatTimeIsIt()
> {
> try
> {
> return DateTime.Now.ToLongTimeString();
> }
> catch (Exception e)
> {
> EventLog.WriteEntry("RemoteClock", e.Message, EventLogEntryType.Error);
> }
>
> return string.Empty;
> }
>
> I created a folder on my web server C:\Inetpub\wwwroot\RemoteClock and
copied a config file "web.config" into it:
> <configuration>
> <system.runtime.remoting>
> <application>
> <channels>
> <channel ref="http" />
> </channels>
> <service>
> <wellknown mode="SingleCall" type="RemoteClock.Clock,
RemoteClock"
> objectUri="Clock.soap" />
> </service>
> </application>
> </system.runtime.remoting>
> </configuration>
>
> In a bin folder off this root folder I copied my Common.dll and
RemoteClock.dll. In IIS, I created a virtual directory called "ServerClock"
which points to the above root directory.
>
> My client is a simple console app:
>
> class Client
> {
> /// <summary>
> /// The main entry point for the application.
> /// </summary>
> [STAThread]
> static void Main(string[] args)
> {
> try
> {
> ChannelServices.RegisterChannel(new HttpChannel());
> IClock clock = (IClock)Activator.GetObject(typeof(IClock),
"http://WebServer:80/ServerClock/Clock.soap");
> Console.WriteLine("The current server time is: " + clock.WhatTimeIsIt());
> }
> catch (Exception e)
> {
> Console.WriteLine("Exception occurred: Source: " + e.Source + "\n\r" +
e.Message + e.StackTrace);
> }
>
> Console.Read();
> }
> }
>
> NOTE: I replaced my actual web server name with "WebServer" in the url.
>
> When I execute the client app, I get the following exception:
>
> Exception occurred: Source: mscorlib
> Server encountered an internal error. To get more info turn on
customErrors in t
> he server's config file.
>
> 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 Common.IClock.WhatTimeIsIt()
> at Client.Client.Main(String[] args) in c:\source\client\client.cs:line
25
> --------------------------------
>
> Any ideas?
>
> Thanks!
>
> -----------------------
> Posted by a user from .NET 247 (http://www.dotn...)
>
> <Id>qIpNgvfPT0+h+2xtAiTfPQ==</Id>