Groups | Blog | Home
all groups > dotnet remoting > august 2003 >

dotnet remoting : CAO Hosted by IIS works on localhost but not ouside server?


Levi Wilson
8/29/2003 10:34:52 AM
Alright, I was able to get a CAO in IIS to function properly, but it only
works when the object is hosted by IIS on my local machine. If I put the
CAOTest object on one of our outside servers, I get a WebException with a
404 Not found. Does this make any sense? Here is my test code. Btw, I
checked out the logfiles on both my local server and my ouside server:

Local Server Example logfile:

14:18:36 127.0.0.1 POST /CAOTest/RemoteActivationService.rem 200
14:18:36 192.168.0.177 POST
/CAOTest/4aa69ee7_ab98_4b2e_9973_4f570296a90b/JLz7QvA7xXPojsu7Rim+JIcN_13.re
m 200


Outside Server Example logfile:
2003-08-29 15:46:02 xxx.xxx.xxx.xxx - xxx.xxx.xxx.xxx 80 POST
/CAOTest/RemoteActivationService.rem - 200
Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+5.1.2600.0;+MS+.NET+Remoting;+MS+
..NET+CLR+1.1.4322.573+)

(ip addresses removed i.e. "xxx.xxx.xxx.xxx")

So, as you can see, it appears as though it's calling the right service or
something? But the methods can't be executed? I don't understand at all.
One thing that might be noted, is that both these virtual directories are
set up in the same manner, except for that the outside server is a domain
controller, and the user to be able to used as Anonymous for IIS is set up
correctly as per the MSDN article about setting up things correctly on a
domain controller with ASP.NET. Any help would be greatly appreciated,
thanks!

////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
client.cs
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
using System;
using System.Runtime.Remoting;
using CAOLib;

namespace CAOClient
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
if(args.Length < 1)
{
Console.WriteLine("Format: CAOClient [Username]");
return;
}

string sName = (string)args.GetValue(0);
RemotingConfiguration.RegisterActivatedClientType(new
ActivatedClientTypeEntry("CCAOImpl", "CAOLib",
"http://xxx.xxx.xxx.xxx/CAOTest/"));
CCAOImpl o = new CCAOImpl(sName);
Console.WriteLine(o.GetServerTime().ToString());
while(Console.ReadLine()!="stop")
{
Console.WriteLine(o.Username);
}
}
}
}

////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
CCAOImpl.cs
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
using System;
using System.Runtime.Remoting;

namespace CAOLib
{
public interface ICAO
{
DateTime GetServerTime();
string Username{get;set;}
}

/// <summary>
/// Summary description for Class1.
/// </summary>
public class CCAOImpl : MarshalByRefObject, ICAO
{
public string m_Username;

public CCAOImpl(string name)
{
//
// TODO: Add constructor logic here
//
m_Username = name;
}
#region ICAO Members

public DateTime GetServerTime()
{
// TODO: Add CCAOImpl.GetServerTime implementation
return DateTime.Now;
}

public string Username
{
get{return m_Username;}
set{m_Username=value;}
}

#endregion
}
}

////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
web.config
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
<configuration>
<system.runtime.remoting>
<application>
<service>
<activated mode="Singleton" type="CAOLib.CCAOImpl, CAOLib"/>
</service>
</application>
</system.runtime.remoting>
</configuration>

Kumar Gaurav Khanna [.NET MVP]
8/31/2003 7:16:52 PM
Hi!

404 indicates that the object in question couldnt be found, implying that
the registration of your object with IIS/remoting framework isnt working
properly. And if you are sure that the configuration is all fine, make sure
that the call doesn't get stopped by a proxy.

--

Regards,
Gaurav Khanna
----------------------------------------------------------------------------
----------------
Microsoft MVP - .NET, MCSE Windows 2000/NT4, MCP+I
WinToolZone - Spelunking Microsoft Technologies
http://www.wintoolzone.com/
[quoted text, click to view]

Levi Wilson
9/8/2003 9:10:47 AM
but why would it work on localhost, but not my external server? The
security settings are set up in the same way for the directories, and all I
did is replicate the structure of my virtual directory on my localhost to
the external server...I don't know what the difference is.

Levi

[quoted text, click to view]

sterny328 NO[at]SPAM hotmail.com
9/12/2003 11:33:36 AM
Try changing your web.config to the following where x.x.x.x is the IP
address of your server.

////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
web.config
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////
<configuration>
<system.runtime.remoting>
<application>
<service>
<activated mode="Singleton" type="CAOLib.CCAOImpl,
CAOLib"/>
</service>
<channels>
<channel ref="http" machineName="x.x.x.x"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>

I had a similar situation in this thread:

http://groups.google.com/groups?q=remoting+IIS+404&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=4658f5d7.0307291307.63affb50%40posting.google.com&rnum=5

-Dave S.


[quoted text, click to view]
AddThis Social Bookmark Button