Lord2702
9/10/2004 5:47:00 PM
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 MBRO
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 MBRO. 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 Dad@discussions.microsoft.com> wrote in
message news:E35AD241-B6CE-4FF9-A7F3-D897D31E72EA@microsoft.com...
> 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>
>
>