Re: IIS hosting remote object
From: Sam Santiago (ssantiago_at_n0spam-SoftiTechture.com)
Date: 10/17/04
- Previous message: Robert Jordan: "Re: Passing XMLNodes from ServicedComponent to Client"
- In reply to: Greg via .NET 247: "IIS hosting remote object"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 17 Oct 2004 09:57:01 -0700
Check out this article for help on a simple example:
HOW TO: Host a Remote Object in Microsoft Internet Information Services
http://support.microsoft.com/default.aspx?scid=312107
Thanks,
Sam
-- _______________________________ Sam Santiago ssantiago@n0spam-SoftiTechture.com http://www.SoftiTechture.com _______________________________ "Greg via .NET 247" <anonymous@dotnet247.com> wrote in message news:%23hkaRHDtEHA.2788@TK2MSFTNGP09.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.dotnet247.com/) > > <Id>5xYkLSU/80OjtYF0yrB76g==</Id>
- Previous message: Robert Jordan: "Re: Passing XMLNodes from ServicedComponent to Client"
- In reply to: Greg via .NET 247: "IIS hosting remote object"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|