Search code examples
.netiis-expressremoting

Host .NET Remoting in IIS Express


I am in the middle of converting a legacy system that uses extensive .NET Remoting to a more contemporary communication framework, and I am trying to get it to run locally prior to any major revisions. My local setup is Visual Studio 2013, and I would like to host in IIS Express.

I am attempting to work through this example here and receive a NullReferenceException pulling credentials from Props. It appears ChannelServices.GetChannelSingProperties() has returned null.

// GetChannelSinkProperties returns null
IDictionary Props = ChannelServices.GetChannelSinkProperties(service);
// NullReferenceException below
Props["credentials"] = CredentialCache.DefaultCredentials;

I will continue to plunk away at this, but I am hoping an expert out there can help me out.

Further details:

My setup is Visual Studio 2013,

  1. Created a new Console Application, placed client and app.config in this project

  2. Created an Empty Web Application, placed server and web.config in this project

  3. Visual Studio hosts my site on localhost:53645, and I have changed client app.config to hit both localhost, and localhost:53645.

This ought to work, right?


Solution

  • Yes it should work. There is something wrong with your configuration, either server or client. Most likely problem is in your service type. If you just copied web.config and app.config from example, you might miss that in service>wellknown>type you use type name of your service class (including namespace!) and assembly name (which you might not call ServiceClass as in example. If this is the case, just set service type correctly (in both server and client configs) to "YourNamespace.YourServiceClass, YourServiceAssemblyName" and you should be fine. And of course url should be just http://localhost:53645/SAService.pm in client config.