Binary of HTTP config issues
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.remoting.

Post a new message to this list...

cduden
I have tried:

Server Web.config:
<system.runtime.remoting>
<application>
<channels>
<channel ref="http">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>
<service>
<wellknown mode="SingleCall" type="NFC.UserManagement.UserManager,
NFC.UserManagement" objectUri="UserManager.rem" />
</service>

</application>
</system.runtime.remoting>

Windows Client:

<system.runtime.remoting>
<application>
<channels>
<channel type="System.Runtime.Remoting.Channels.Http.HttpChannel,
System.Runtime.Remoting"/>
<clientProviders>
<formatter
type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider,
System.Runtime.Remoting" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

AND:

Server web config:
<channels>
<channel ref="http">
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>

Client config:
<system.runtime.remoting>
<application>
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

AND Countless other permutations. Using TCPTrace I can see what is being
sent and recieved -- it is either SOAP or it doesn't work. Consequently
the same calls work if I use the following:

SERVER:
<channels>
<channel ref="http">
<serverProviders>
<provider ref="wsdl" />
<formatter ref="soap" typeFilterLevel="Full" />
</serverProviders>
</channel>
</channels>

CLIENT:

<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="soap" />
</clientProviders>
</channel>
</channels>

Using the soap formater. If I attempt to specify the client formatter and
leave the server empty then it works but inspecting the payload reveals that
it is using SOAP. When I try to force binary it fails with the following
error:

Additional information: System.ArgumentNullException: No message was
deserialized prior to calling the DispatchChannelSink.

Parameter name: requestMsg

at
System.Runtime.Remoting.Channels.DispatchChannelSink.ProcessMessage(IServerC
hannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders
requestHeaders, Stream requestStream, IMessage& responseMsg,
ITransportHeaders& responseHeaders, Stream& responseStream)

at
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IS
erverChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders
requestHeaders, Stream requestStream, IMessage& responseMsg,
ITransportHeaders& responseHeaders, Stream& responseStream)

at
System.Runtime.Remoting.Channels.Http.HttpHandlerTransportSink.HandleRequest
(HttpContext context)

at
System.Runtime.Remoting.Channels.Http.HttpRemotingHandler.InternalProcessReq
uest(HttpContext context)

What am I missing here? How do I set this up to work forcing the binary
formatter over HTTP (hosted in IIS).

Thanks,

CMD

Reply to this message...
 
    
Sam Santiago
This works for me:

Server config file hosted in IIS. Nothing special since channel must be
HTTP and client will control formatting:

<system.runtime.remoting>
<application>
<service>
<activated type="My.Class, MyAssembly" />
</service>
</application>
</system.runtime.remoting>

Client Config:

<system.runtime.remoting>
<application name="OrderServicesClient">
<client url="http://localhost:8085/";>
<activated type="My.Class, MyAssembly" />
</client>
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>

Thanks,

Sam

--
_______________________________
Sam Santiago
Click here to reveal e-mail address
http://www.SoftiTechture.com
_______________________________
"cduden" <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...
 
    
cduden
I just cut and pasted your config settings into my server web config and
client appconfig. It works great for me too Sam except when I inspect the
payload of the traffic between client and server it is a soap envelope so I
don't think that the binary serialization is actually happening.

"Sam Santiago" <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...
 
    
Sam Santiago
I see binary for sure. I'm using the ethereal network protocol analyzer:
http://www.ethereal.com/. The HTTP content type is Content-Type:
application/octet-stream. It's an open source analyzer so try it out.

Thanks,

Sam

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

Reply to this message...
 
    
cduden
Ok, Ethereal looks a bit more comprehensive than what I am using, thanks.
Assuming that it is using Binary -- if I use the following:

Server:

No channels defined, just the services

Client:
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
</channels>

It works. Question

given that the above will function when I add the following to the server
config:

<channels>
<channel ref="http">
<serverProviders>
<formatter ref="binary" />
</serverProviders>
</channel>
</channels>
It ceases to function. Any insight in to why that is? I get the error
listed above.

"Sam Santiago" <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...
 
    
Sam Santiago
Not sure, but when you see the packet trace you might see that you are
getting back some kind of HTTP error response vs. a binary stream therefore
causing a bogus error.

Here's another example of using the binary formatter with IIS and HTTP:

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

With Ethereal, once you see an HTTP packet, right click on it and select
Follow TCP Stream to view a window that's more readable. Click the Clear
button if you want to go back to full output list.

Thanks,

Sam

--
_______________________________
Sam Santiago
Click here to reveal e-mail address
http://www.SoftiTechture.com
_______________________________
"cduden" <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...
 
    
cduden
This will be a long post as I am going to essentially post the entire test
harness where I am observing this odd behaviour and what I am seeing in
TCPTrace (I can't get Ethereal to give me any useful information regarding
local TCP traffic on my machine).

In the Web Project called "BinaryRemotingTest":

Simple class --
using System;
using BinarayRemotingTestShared;

namespace BinaryRemotingTest
{
/// <summary>
/// Summary description for GetRandomNumber.
/// </summary>
public class GetRandomNumber: MarshalByRefObject, IGetRandomNumber
{
public GetRandomNumber()
{
}
public int GetRand()
{
System.Random rnd = new System.Random(System.Environment.TickCount);

return rnd.Next();
}
}
}

web.config:

<system.runtime.remoting>
<application>
<channels>
<channel ref="http" priority="100">
<formatter ref="binary" />
</channel>
</channels>
<service>
<wellknown mode="SingleCall" type="BinaryRemotingTest.GetRandomNumber,
BinaryRemotingTest" objectUri="Rand.rem" />
</service>
</application>
</system.runtime.remoting>

Shared Assembly between web project and windows client called
"BinarayRemotingTestShared" with a single interface

using System;

namespace BinarayRemotingTestShared
{
/// <summary>
/// Summary description for Class1.
/// </summary>
public interface IGetRandomNumber
{
int GetRand();
}
}

Windows Test client --very simple label and button that when clicked :

private void button1_Click(object sender, System.EventArgs e)
{
BinarayRemotingTestShared.IGetRandomNumber IRN =
(IGetRandomNumber)Activator.GetObject(typeof(IGetRandomNumber),@"http://loca
lhost:81/BinaryRemotingTest/Rand.rem");
this.label1.Text = IRN.GetRand().ToString();
}

Windows App Config:

<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="http" port="0">
<clientProviders>
<formatter ref="binary" />
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
</configuration>

NOTICE the URL is pointed to port 81. The actaul web project is on port
80 -- this is so I can insert TCPTrace between the client and server. When
I run and click the button this is what I see from TCPTrace:

POST /BinaryRemotingTest/Rand.rem HTTP/1.1
User-Agent: Mozilla/4.0+(compatible; MSIE 6.0; Windows 5.1.2600.0; MS .NET
Remoting; MS .NET CLR 1.1.4322.2032 )
Content-Type: text/xml; charset="utf-8"
SOAPAction:
"http://schemas.microsoft.com/clr/nsassem/BinarayRemotingTestShared.IGetRand
omNumber/BinarayRemotingTestShared#GetRand"
Content-Length: 586
Expect: 100-continue
Connection: Keep-Alive
Host: localhost:81

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Body>
<i2:GetRand id="ref-1"
xmlns:i2="http://schemas.microsoft.com/clr/nsassem/BinarayRemotingTestShared
..IGetRandomNumber/BinarayRemotingTestShared">
</i2:GetRand>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

AND the response:

HTTP/1.1 100 Continue
Server: Microsoft-IIS/5.1
Date: Wed, 01 Sep 2004 16:11:36 GMT
X-Powered-By: ASP.NET

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.1
Date: Wed, 01 Sep 2004 16:11:37 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Server: MS .NET Remoting, MS .NET CLR 1.1.4322.2032
Cache-Control: private
Content-Type: text/xml; charset="utf-8"
Content-Length: 933

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<SOAP-ENV:Header>
<h4:__CallContext href="#ref-3"
xmlns:h4="http://schemas.microsoft.com/clr/soap/messageProperties";
SOAP-ENC:root="1"/>
<a1:LogicalCallContext id="ref-3"
xmlns:a1="http://schemas.microsoft.com/clr/ns/System.Runtime.Remoting.Messag
ing">
</a1:LogicalCallContext>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<i5:GetRandResponse id="ref-1"
xmlns:i5="http://schemas.microsoft.com/clr/nsassem/BinarayRemotingTestShared
..IGetRandomNumber/BinarayRemotingTestShared">
<return>1683973258</return>
</i5:GetRandResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This is not what I would expect to see, when I use TCP Trace to look at a
different service (windows service using tcp\binary) it essentially shows no
content for the request \ response because it was intended for use with text
types not binary, however, it does show the bytes sent and recieved.. I
would have expected to see the same thing with the test harness above,
instead what I am seeing is XML \ SOAP even though both the client and
server are configured for the binary formatter. Interestingly if I change
both the client and server to specificy the soap formatter the request \
response is identical in all aspects.

Any insight into what is going on would be appreciated.

"Sam Santiago" <Click here to reveal e-mail address> wrote in message
news:%238HREf%Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Ken Kolda
The web.config you show in this message is missing the <serverProviders>
tag. I see that you have that in your earlier versions of the fiel (from
prior posts), but wanted to verify it's still there. Also, are you calling
RemotingConfiguration.Configure() on the client before fetching the remoted
object?

Ken

"cduden" <Click here to reveal e-mail address> wrote in message
news:u15e$$Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
cduden
Thank you Ken, I assumed that putting the remote config entries in the
windows client application config file would eliminate the requirement to
call RemotingConfiguration.Config("filename"). As soon as I added that, it
works as I would have expected.

"Ken Kolda" <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...
 
    
cduden
Sam, I have spent the last hour looking at Ethereal, how do you make it
analyze traffic on the local machine, I only seem to be able to connect to
one of my network adapters and it doesn't seem to pick up traffic on the
local machine (client --> web server)

"Sam Santiago" <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...
 
    
Sam Santiago
I have not been able to monitor local traffic either. It's worth the effort
using another machine just to see network traffic details.

Thanks,

Sam

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

Reply to this message...
 
 
System.Activator
System.ArgumentNullException
System.Environment
System.EventArgs
System.MarshalByRefObject
System.Random
System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider
System.Runtime.Remoting.Channels.BinaryServerFormatterSink
System.Runtime.Remoting.Channels.Http.HttpChannel
System.Runtime.Remoting.Channels.Http.HttpRemotingHandler
System.Runtime.Remoting.Channels.ITransportHeaders
System.Runtime.Remoting.Messaging.CallContext
System.Runtime.Remoting.Messaging.IMessage
System.Runtime.Remoting.Messaging.LogicalCallContext
System.Runtime.Remoting.RemotingConfiguration
System.Web.HttpContext




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com