Words on my addictions: .NET, Philosophy, Music

21 March 2007

.NET Remoting in IIS Server

Filed under: C# — stefanprodan @ 12:14 am

In the yesterday post (.NET Remoting binary config) I’ve showed how to host an object in a windows application, this post will show the IIS hosting config. To make this really easy create in VS.NET a new web site project named AlephServer and add a reference to the AlephServerCore.dll. Next add a web.config to the project with this content:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
<system.runtime.remoting>
<application>
<service>
<wellknown mode=”Singleton” type=”AlephServerCore.Service, AlephServerCore” objectUri=”AlephServer.rem” />
</service>
<channels>
<channel ref=”http”>
<serverProviders>
<formatter ref=”binary” typeFilterLevel=”Full” />
</serverProviders>
</channels>
</application>
</system.runtime.remoting>
</configuration>

The client code will not change at all, just the config file. The URL will no longer be ”http://localhost:8080/AlephServer” but ”http://localhost/AlephServer.rem” because the IIS will use the default 80 port.

PS: There is a difference between  the windows app hosting and the IIS and that is an ASP.NET bug, when the server will timeout the BinaryFormatter will try to interpret the HTML text as a binary input. To fix this you’ll have to use a custom Channel Sink made by Richard Blewett. The project and can be downloaded from his blog.

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: