.NETGURU
Hosting On IIS
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Naeem Hassan Dad (VIP)
Hello
I am really fed up by the following simple problem. I write a
interface IPlyer and produce RemotingLibrary.dll. I Implement this Interface
using MyRemote class which is also a Remote Object and it produce
RemoteServer.dll.
I create a virtual directory named Test and copy these dlls in this
directory to host remote object on IIS. And An
Problem is occur when I execute client application. That is when I used
configuration file for configuration. The Exception occur file not found but
file is there after exception occur file deleted from its location.
Second When i used to configure using
RemotingConfiguration.RegisterWellKnownClientType(typeof(IPlayer),            "http://localhost:80/Test/MyServer.rem";);
It executed this statment but excption of logon failde occur when reomote is
called.

Here is the source of this problem including configuration files. All these
files in same virtual directory and this virtual directory has no Annonymous
Access .Can some one copy these and compile to reproduce the behavior or tell
me where I went wrong.

//RemotingLibrary.cs
namespace RemotingLibrary
{
    public interface IPlayer
    {
        string GetCurrentSong();
    }
}
------------------------------------------------------------------------------------------
here is Implementation of IPlyer which is also a remote object
//RemotingServer.css

namespace RemotingServer
{
    public class MyRemote: MarshalByRefObject, IPlayer
    {
        string song;

        public MyRemote(string song)
        {
            this.song = song;
        }

        public string GetCurrentSong()
        {
            return song;
        }
    }
}
---------------------------------------------------------------------------------------------
And Here is the client Application
//RemotingClient.cs
using System;
using System.Runtime.Remoting;
using RemotingLibrary;

namespace RemotingClient
{
class RemoteClient
{
    public static void Main()

{        /*RemotingConfiguration.RegisterWellKnownClientType(typeof(IPlayer),            "http://localhost:80/Test/MyServer.rem";);*/

    RemotingConfiguration.Configure("RemotingClient.exe.config");
    IPlayer player = (IPlayer)Activator.GetObject(typeof(IPlayer),
            "http://localhost:80/Test";);

try
    {
        string str;
        Console.WriteLine(player.GetCurrentSong());
    }
    catch(Exception ex)
    {
     error = ex.Message;
    }
}
}
}
----------------------------------------------------------------------------------
//Web.config
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode="SingleCall" type="RemotingServer.MyRemote,
RemotingServer" objectUri="MyServer.rem" />

</service>

<channels>
<channel ref="http">
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

---------------------------------------------------------------------------------------------
//RemotingClient.exe.config
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http" useDefaultCredentials="true" port="0">
<clientProviders>
<formatter
ref="binary"
/>
</clientProviders>
</channel>
</channels>
<client>
<wellknown
url="http://localhost:80/Test/Server.rem";
type="RemotingServer.MyRemote, RemotingServer"
/>
</client>
</application>
</system.runtime.remoting>
</configuration>

Reply to this message...
 
    
Ken Kolda
You have several issues you need to resolve, some of which may be just that
you didn't correctly copy the code into your post. Your issues are:

1) You're mixing two means of activating your object in your client code.
You should either register the well known object (either via the config file
or thru code) OR you should use the Activator.GetObject() -- there's no need
to do both. So, to use the activator (which is my preference), change the
code to:

IPlayer player = (IPlayer)Activator.GetObject(typeof(IPlayer),
"http://localhost:80/Test/MyServer.rem";);

Note that you have to provide the full URL in the call to GetObject() -- you
had omitted the "MyServer.rem".

2) Your MyRemote() object only has a parameterized constructor. In order to
be used as a server-activated object, it must have a zero-argument
constructor.

3) The DLLs should be in a subdirectory of your web app named "bin".

4) You've specified a binary formatter on the client side but not on the
server side.

Ken

"Naeem Hassan Dad" <Naeem Hassan Click here to reveal e-mail address> wrote in
message news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Ken Kolda
Ignore the last point -- you don't need to specify this as it is
automatically detected.

Ken

"Ken Kolda" <Click here to reveal e-mail address> wrote in message
news:%Click here to reveal e-mail address...
> You have several issues you need to resolve, some of which may be just
that
[Original message clipped]

Reply to this message...
 
    
Lord2702
Fri. Sep. 10, 2004 10:40 AM PT

I also face the same problem, while hosting on IIS. Follow these steps.
1. Create a virtual directory on IIS. In your case I think it is Test. Now
physical path may be somewhere on your HD.
2. Create a Bin directory by using your Win Explorer, under this Test.
3. Copy your web.config, which is correct, in this directory, and your ExamGuruO
object in Bin dir.
4. Now also create a file, name it MyServer.rem. Because this is the URL
that you are using. Type the following line in this file.

<%@ WebService class="MyNamespace.MyClass" %>

MyNamespace.MyClass ===> is your full qualified name of your ExamGuruO. keep this
file in your Test directory.

Make sure you provide channels in your web.config.

<channels>
<channel ref="http">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="soap" typeFilterLevel="Low" />
<formatter ref="binary" typeFilterLevel="Low" />
</serverProviders>
</channel>
</channels>

This is your IIS settings over. Check your client side, I think this is OK.
Try running it should work. In client app, when using Activator.GetObject
use the complete path as follows: http://localhost:80/Test/MyServer.rem also
don't forget to get the default credentials after Activator.GetObject as
follows...
IDictionary *props =
ChannelServices::GetChannelSinkProperties(<MyObjectProxy>);
props->Item[S"credentials"] =
System::Net::CredentialCache::DefaultCredentials;

You are all set.

Good Luck.

"Naeem Hassan Dad" <Naeem Hassan Click here to reveal e-mail address> wrote in
message news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Naeem Hassan Dad (VIP)
I follow all above steps but my problem is not related to a web service.
Actually this is problem about Remoting. Thanks for your answer. If you again
look at my problem. I am fed up. Whenever I try to call
RemotingConfiguration.Configure("RemotingClient.exe.config"); It delete the
RemotingClient.exe.config file from its path and I have no idea why it is
happened.

"Lord2702" wrote:

[Original message clipped]

Reply to this message...
 
    
Momin Khalil
Hi

Only Client activated objects can have non default constructors.
Wellknow SingleCall or Singleton class must have a default constructor
(constructor that does not take any parameters). Also make sure that
the web.config file is in your virtual root and the dlls are in a sub
directory called bin under you root.

Hope this helps

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
 
    
Sam Santiago
You might want to review this article:

Remoting Example: Hosting in IIS
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconremotingexamplehostinginiis.asp

Thanks,

Sam

--
_______________________________
Sam Santiago
Click here to reveal e-mail address
http://www.SoftiTechture.com
_______________________________
"Naeem Hassan Dad" <Naeem Hassan Click here to reveal e-mail address> wrote in
message news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Naeem Hassan Dad (VIP)
I already study this example it work fine. But my problem still there cannont
be solved.
Reply to this message...
 
 
System.Activator
System.Collections.IDictionary
System.Console
System.MarshalByRefObject
System.Net.CredentialCache
System.Runtime.Remoting.Channels.ChannelServices
System.Runtime.Remoting.RemotingConfiguration
System.Web.Services.WebService




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification