We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
ADAsyncWorkItem
-
Expand
AggregateDictionary
-
Expand
AsyncCopyStreamResult
-
Expand
AsyncMessageHelper
-
Expand
AsyncWorkItem
-
Expand
BaseChannelObjectWithProperties
-
Expand
BaseChannelSinkWithProperties
-
Expand
BaseChannelWithProperties
-
Expand
BaseTransportHeaders
-
Expand
BaseTransportHeadersEnumerator
-
Expand
BasicAsyncResult
-
Expand
BinaryClientFormatterSink
-
AsyncProcessMessage(IMessage, IMessageSink)
-
AsyncProcessRequest(IClientChannelSinkStack, IMessage, ITransportHeaders, Stream)
-
AsyncProcessResponse(IClientResponseChannelSinkStack, object, ITransportHeaders, Stream)
-
BinaryClientFormatterSink(IClientChannelSink)
-
ChannelProtocol()
-
DeserializeMessage(IMethodCallMessage, ITransportHeaders, Stream)
-
GetRequestStream(IMessage, ITransportHeaders)
-
IncludeVersioning()
-
NextChannelSink()
-
NextSink()
-
ProcessMessage(IMessage, ITransportHeaders, Stream, ITransportHeaders, Stream)
-
Properties()
-
SerializeMessage(IMessage, ITransportHeaders, Stream)
-
StrictBinding()
-
SyncProcessMessage(IMessage)
-
Expand
BinaryClientFormatterSinkProvider
-
Expand
BinaryServerFormatterSink
-
Expand
BinaryServerFormatterSinkProvider
-
Expand
CachedSocket
-
Expand
CachedSocketList
-
Expand
ChannelDataStore
-
Expand
ChannelServices
-
Expand
ChannelServicesData
-
Expand
ChunkedMemoryStream
-
Expand
ClientChannelSinkStack
-
Expand
CommonTransportKeys
-
Expand
CoreChannel
-
Expand
CrossAppDomainChannel
-
Expand
CrossAppDomainData
-
Expand
CrossAppDomainSerializer
-
Expand
CrossAppDomainSink
-
Expand
CrossContextChannel
-
Expand
DictionaryEnumeratorByKeys
-
Expand
DispatchChannelSink
-
Expand
DispatchChannelSinkProvider
-
Expand
ExclusiveTcpListener
-
Expand
IAuthorizeRemotingConnection
-
Expand
IChannel
-
Expand
IChannelDataStore
-
Expand
IChannelReceiver
-
Expand
IChannelReceiverHook
-
Expand
IChannelSender
-
Expand
IChannelSinkBase
-
Expand
IClientChannelSink
-
Expand
IClientChannelSinkProvider
-
Expand
IClientChannelSinkStack
-
Expand
IClientFormatterSink
-
Expand
IClientFormatterSinkProvider
-
Expand
IClientResponseChannelSinkStack
-
Expand
ISecurableChannel
-
Expand
IServerChannelSink
-
Expand
IServerChannelSinkProvider
-
Expand
IServerChannelSinkStack
-
Expand
IServerFormatterSinkProvider
-
Expand
IServerResponseChannelSinkStack
-
Expand
ITransportHeaders
-
Expand
MemoryChunk
-
Expand
NativeMethods
-
Expand
Perf_Contexts
-
Expand
Protocol
-
Expand
Protocol
-
Expand
RegisteredChannel
-
Expand
RegisteredChannelList
-
Expand
RemoteConnection
-
Expand
RemotingProfilerEvent
-
Expand
RequestQueue
-
Expand
ServerAsyncReplyTerminatorSink
-
Expand
ServerChannelSinkStack
-
Expand
ServerProcessing
-
Expand
SinkChannelProtocol
-
Expand
SinkProviderData
-
Expand
SinkStack
-
Expand
SinkStack
-
Expand
SoapClientFormatterSink
-
Expand
SoapClientFormatterSinkProvider
-
Expand
SoapServerFormatterSink
-
Expand
SoapServerFormatterSinkProvider
-
Expand
SocketCache
-
Expand
SocketCachePolicy
-
Expand
SocketHandler
-
Expand
SocketStream
-
Expand
StreamHelper
-
Expand
StringHelper
-
Expand
TokenInformationClass
-
Expand
TransportHeaders
-
Expand
UriHeaderHandler
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- using System;
- using System.Collections;
- using System.IO;
- using System.Reflection;
- using System.Runtime.Serialization.Formatters;
- using System.Runtime.Remoting;
- using System.Runtime.Remoting.Channels;
- using System.Runtime.Remoting.Channels.Http;
- using System.Runtime.Remoting.Messaging;
- using System.Runtime.Remoting.Metadata;
- using System.Security;
- using System.Security.Permissions;
- using System.Globalization;
- namespace System.Runtime.Remoting.Channels
- {
-
-
-
-
-
- public class BinaryClientFormatterSinkProvider : IClientFormatterSinkProvider
- {
- private IClientChannelSinkProvider _next;
-
-
- private bool _includeVersioning = true;
- private bool _strictBinding = false;
-
-
- public BinaryClientFormatterSinkProvider()
- {
- }
-
-
- public BinaryClientFormatterSinkProvider(IDictionary properties, ICollection providerData)
- {
-
- if (properties != null) {
- foreach (DictionaryEntry entry in properties) {
- string keyStr = entry.Key.ToString();
- switch (keyStr) {
- case "includeVersions":
- _includeVersioning = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
- break;
- case "strictBinding":
- _strictBinding = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
- break;
- default:
-
- break;
- }
- }
- }
-
-
- CoreChannel.VerifyNoProviderData(this.GetType().Name, providerData);
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData)
- {
- IClientChannelSink nextSink = null;
- if (_next != null) {
- nextSink = _next.CreateSink(channel, url, remoteChannelData);
- if (nextSink == null)
- return null;
- }
-
- SinkChannelProtocol protocol = CoreChannel.DetermineChannelProtocol(channel);
-
- BinaryClientFormatterSink sink = new BinaryClientFormatterSink(nextSink);
- sink.IncludeVersioning = _includeVersioning;
- sink.StrictBinding = _strictBinding;
- sink.ChannelProtocol = protocol;
- return sink;
- }
-
- public IClientChannelSinkProvider Next {
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- get { return _next; }
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- set { _next = value; }
- }
- }
-
-
- public class BinaryClientFormatterSink : IClientFormatterSink
- {
- private IClientChannelSink _nextSink = null;
-
- private bool _includeVersioning = true;
-
- private bool _strictBinding = false;
-
- private SinkChannelProtocol _channelProtocol = SinkChannelProtocol.Other;
-
-
- public BinaryClientFormatterSink(IClientChannelSink nextSink)
- {
- _nextSink = nextSink;
- }
-
- internal bool IncludeVersioning {
- set { _includeVersioning = value; }
- }
-
- internal bool StrictBinding {
- set { _strictBinding = value; }
- }
-
- internal SinkChannelProtocol ChannelProtocol {
- set { _channelProtocol = value; }
- }
-
-
-
- public IMessageSink NextSink {
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- get {
- throw new NotSupportedException();
- }
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public IMessage SyncProcessMessage(IMessage msg)
- {
- IMethodCallMessage mcm = msg as IMethodCallMessage;
- IMessage retMsg;
-
- try {
-
- ITransportHeaders headers;
- Stream requestStream;
- SerializeMessage(msg, out headers, out requestStream);
-
-
- Stream returnStream;
- ITransportHeaders returnHeaders;
- _nextSink.ProcessMessage(msg, headers, requestStream, out returnHeaders, out returnStream);
- if (returnHeaders == null)
- throw new ArgumentNullException("returnHeaders");
-
-
- retMsg = DeserializeMessage(mcm, returnHeaders, returnStream);
- }
- catch (Exception e) {
- retMsg = new ReturnMessage(e, mcm);
- }
- catch {
- retMsg = new ReturnMessage(new Exception(CoreChannel.GetResourceString("Remoting_nonClsCompliantException")), mcm);
- }
-
- return retMsg;
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink)
- {
- IMethodCallMessage mcm = (IMethodCallMessage)msg;
- IMessage retMsg;
-
- try {
-
- ITransportHeaders headers;
- Stream requestStream;
- SerializeMessage(msg, out headers, out requestStream);
-
-
- ClientChannelSinkStack sinkStack = new ClientChannelSinkStack(replySink);
- sinkStack.Push(this, msg);
- _nextSink.AsyncProcessRequest(sinkStack, msg, headers, requestStream);
- }
- catch (Exception e) {
- retMsg = new ReturnMessage(e, mcm);
- if (replySink != null)
- replySink.SyncProcessMessage(retMsg);
- }
- catch {
- retMsg = new ReturnMessage(new Exception(CoreChannel.GetResourceString("Remoting_nonClsCompliantException")), mcm);
- if (replySink != null)
- replySink.SyncProcessMessage(retMsg);
- }
-
- return null;
- }
-
-
-
- private void SerializeMessage(IMessage msg, out ITransportHeaders headers, out Stream stream)
- {
- BaseTransportHeaders requestHeaders = new BaseTransportHeaders();
- headers = requestHeaders;
-
-
- requestHeaders.ContentType = CoreChannel.BinaryMimeType;
- if (_channelProtocol == SinkChannelProtocol.Http)
- headers["__RequestVerb"] = "POST";
-
- bool bMemStream = false;
- stream = _nextSink.GetRequestStream(msg, headers);
- if (stream == null) {
- stream = new ChunkedMemoryStream(CoreChannel.BufferPool);
- bMemStream = true;
- }
- CoreChannel.SerializeBinaryMessage(msg, stream, _includeVersioning);
- if (bMemStream)
- stream.Position = 0;
- }
-
-
-
- private IMessage DeserializeMessage(IMethodCallMessage mcm, ITransportHeaders headers, Stream stream)
- {
-
- IMessage retMsg = CoreChannel.DeserializeBinaryResponseMessage(stream, mcm, _strictBinding);
-
- stream.Close();
- return retMsg;
- }
-
-
-
-
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public void ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, out ITransportHeaders responseHeaders, out Stream responseStream)
- {
-
- throw new NotSupportedException();
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, IMessage msg, ITransportHeaders headers, Stream stream)
- {
-
- throw new NotSupportedException();
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, object state, ITransportHeaders headers, Stream stream)
- {
-
- IMethodCallMessage mcm = (IMethodCallMessage)state;
- IMessage retMsg = DeserializeMessage(mcm, headers, stream);
- sinkStack.DispatchReplyMessage(retMsg);
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public Stream GetRequestStream(IMessage msg, ITransportHeaders headers)
- {
-
- throw new NotSupportedException();
- }
-
-
- public IClientChannelSink NextChannelSink {
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- get { return _nextSink; }
- }
-
-
- public IDictionary Properties {
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- get { return null; }
- }
-
-
-
-
-
- }
-
-
-
-
-
-
-
- public class BinaryServerFormatterSinkProvider : IServerFormatterSinkProvider
- {
- private IServerChannelSinkProvider _next = null;
-
-
- private bool _includeVersioning = true;
- private bool _strictBinding = false;
- private TypeFilterLevel _formatterSecurityLevel = TypeFilterLevel.Low;
-
- public BinaryServerFormatterSinkProvider()
- {
- }
-
-
- public BinaryServerFormatterSinkProvider(IDictionary properties, ICollection providerData)
- {
-
- if (properties != null) {
- foreach (DictionaryEntry entry in properties) {
- string keyStr = entry.Key.ToString();
- switch (keyStr) {
- case "includeVersions":
- _includeVersioning = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
- break;
- case "strictBinding":
- _strictBinding = Convert.ToBoolean(entry.Value, CultureInfo.InvariantCulture);
- break;
- case "typeFilterLevel":
- _formatterSecurityLevel = (TypeFilterLevel)Enum.Parse(typeof(TypeFilterLevel), (string)entry.Value);
- break;
- default:
-
- break;
- }
- }
- }
-
-
- CoreChannel.VerifyNoProviderData(this.GetType().Name, providerData);
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public void GetChannelData(IChannelDataStore channelData)
- {
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public IServerChannelSink CreateSink(IChannelReceiver channel)
- {
- if (null == channel) {
- throw new ArgumentNullException("channel");
- }
-
- IServerChannelSink nextSink = null;
- if (_next != null)
- nextSink = _next.CreateSink(channel);
-
- BinaryServerFormatterSink.Protocol protocol = BinaryServerFormatterSink.Protocol.Other;
-
-
- string uri = channel.GetUrlsForUri("")[0];
- if (String.Compare("http", 0, uri, 0, 4, StringComparison.OrdinalIgnoreCase) == 0)
- protocol = BinaryServerFormatterSink.Protocol.Http;
-
- BinaryServerFormatterSink sink = new BinaryServerFormatterSink(protocol, nextSink, channel);
- sink.TypeFilterLevel = _formatterSecurityLevel;
- sink.IncludeVersioning = _includeVersioning;
- sink.StrictBinding = _strictBinding;
- return sink;
- }
-
- public IServerChannelSinkProvider Next {
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- get { return _next; }
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- set { _next = value; }
- }
-
- [System.Runtime.InteropServices.ComVisible(false)]
- public TypeFilterLevel TypeFilterLevel {
- get { return _formatterSecurityLevel; }
-
- set { _formatterSecurityLevel = value; }
- }
- }
-
-
- public class BinaryServerFormatterSink : IServerChannelSink
- {
- [Serializable()]
- public enum Protocol
- {
- Http,
-
- Other
- }
-
- private IServerChannelSink _nextSink;
-
-
-
- private Protocol _protocol;
-
- private IChannelReceiver _receiver;
-
- private bool _includeVersioning = true;
-
- private bool _strictBinding = false;
-
- private TypeFilterLevel _formatterSecurityLevel = TypeFilterLevel.Full;
- private string lastUri = null;
-
- public BinaryServerFormatterSink(Protocol protocol, IServerChannelSink nextSink, IChannelReceiver receiver)
- {
- if (receiver == null)
- throw new ArgumentNullException("receiver");
-
- _nextSink = nextSink;
- _protocol = protocol;
- _receiver = receiver;
- }
-
-
- internal bool IncludeVersioning {
- set { _includeVersioning = value; }
- }
-
- internal bool StrictBinding {
- set { _strictBinding = value; }
- }
-
- [System.Runtime.InteropServices.ComVisible(false)]
- public TypeFilterLevel TypeFilterLevel {
- get { return _formatterSecurityLevel; }
-
- set { _formatterSecurityLevel = value; }
- }
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, out IMessage responseMsg, out ITransportHeaders responseHeaders, out Stream responseStream)
- {
- if (requestMsg != null) {
-
- return _nextSink.ProcessMessage(sinkStack, requestMsg, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream);
- }
-
- if (requestHeaders == null)
- throw new ArgumentNullException("requestHeaders");
-
- BaseTransportHeaders wkRequestHeaders = requestHeaders as BaseTransportHeaders;
-
- ServerProcessing processing;
-
- responseHeaders = null;
- responseStream = null;
-
- string verb = null;
- string contentType = null;
-
- bool bCanServiceRequest = true;
-
-
- string contentTypeHeader = null;
- if (wkRequestHeaders != null)
- contentTypeHeader = wkRequestHeaders.ContentType;
- else
- contentTypeHeader = requestHeaders["Content-Type"] as string;
- if (contentTypeHeader != null) {
- string charsetValue;
- HttpChannelHelper.ParseContentType(contentTypeHeader, out contentType, out charsetValue);
- }
-
-
- if ((contentType != null) && (String.CompareOrdinal(contentType, CoreChannel.BinaryMimeType) != 0)) {
- bCanServiceRequest = false;
- }
-
-
- if (_protocol == Protocol.Http) {
- verb = (string)requestHeaders["__RequestVerb"];
- if (!verb.Equals("POST") && !verb.Equals("M-POST"))
- bCanServiceRequest = false;
- }
-
-
- if (!bCanServiceRequest) {
-
- if (_nextSink != null) {
- return _nextSink.ProcessMessage(sinkStack, null, requestHeaders, requestStream, out responseMsg, out responseHeaders, out responseStream);
- }
- else {
-
- if (_protocol == Protocol.Http) {
-
- responseHeaders = new TransportHeaders();
- responseHeaders["__HttpStatusCode"] = "400";
- responseHeaders["__HttpReasonPhrase"] = "Bad Request";
- responseStream = null;
- responseMsg = null;
- return ServerProcessing.Complete;
- }
- else {
-
- throw new RemotingException(CoreChannel.GetResourceString("Remoting_Channels_InvalidRequestFormat"));
- }
- }
- }
-
-
- try {
- string objectUri = null;
-
- bool bIsCustomErrorEnabled = true;
- object oIsCustomErrorEnabled = requestHeaders["__CustomErrorsEnabled"];
- if (oIsCustomErrorEnabled != null && oIsCustomErrorEnabled is bool) {
- bIsCustomErrorEnabled = (bool)oIsCustomErrorEnabled;
- }
- CallContext.SetData("__CustomErrorsEnabled", bIsCustomErrorEnabled);
-
- if (wkRequestHeaders != null)
- objectUri = wkRequestHeaders.RequestUri;
- else
- objectUri = (string)requestHeaders[CommonTransportKeys.RequestUri];
-
- if (objectUri != lastUri && RemotingServices.GetServerTypeForUri(objectUri) == null)
- throw new RemotingException(CoreChannel.GetResourceString("Remoting_ChnlSink_UriNotPublished"));
- else
- lastUri = objectUri;
-
- PermissionSet currentPermissionSet = null;
- if (this.TypeFilterLevel != TypeFilterLevel.Full) {
- currentPermissionSet = new PermissionSet(PermissionState.None);
- currentPermissionSet.SetPermission(new SecurityPermission(SecurityPermissionFlag.SerializationFormatter));
- }
-
- try {
- if (currentPermissionSet != null)
- currentPermissionSet.PermitOnly();
-
-
- requestMsg = CoreChannel.DeserializeBinaryRequestMessage(objectUri, requestStream, _strictBinding, this.TypeFilterLevel);
- }
- finally {
- if (currentPermissionSet != null)
- CodeAccessPermission.RevertPermitOnly();
- }
- requestStream.Close();
-
- if (requestMsg == null) {
- throw new RemotingException(CoreChannel.GetResourceString("Remoting_DeserializeMessage"));
- }
-
-
-
- sinkStack.Push(this, null);
- processing = _nextSink.ProcessMessage(sinkStack, requestMsg, requestHeaders, null, out responseMsg, out responseHeaders, out responseStream);
-
- if (responseStream != null) {
- throw new RemotingException(CoreChannel.GetResourceString("Remoting_ChnlSink_WantNullResponseStream"));
- }
-
- switch (processing) {
- case ServerProcessing.Complete:
-
-
- {
- if (responseMsg == null)
- throw new RemotingException(CoreChannel.GetResourceString("Remoting_DispatchMessage"));
-
- sinkStack.Pop(this);
-
- SerializeResponse(sinkStack, responseMsg, ref responseHeaders, out responseStream);
- break;
- }
- break;
- case ServerProcessing.OneWay:
-
-
- {
- sinkStack.Pop(this);
- break;
- }
- break;
- case ServerProcessing.Async:
-
-
- {
- sinkStack.Store(this, null);
- break;
- }
- break;
-
- }
-
- }
- catch (Exception e) {
- processing = ServerProcessing.Complete;
- responseMsg = new ReturnMessage(e, (IMethodCallMessage)(requestMsg == null ? new ErrorMessage() : requestMsg));
-
-
- CallContext.SetData("__ClientIsClr", true);
- responseStream = (MemoryStream)CoreChannel.SerializeBinaryMessage(responseMsg, _includeVersioning);
- CallContext.FreeNamedDataSlot("__ClientIsClr");
- responseStream.Position = 0;
- responseHeaders = new TransportHeaders();
-
- if (_protocol == Protocol.Http) {
- responseHeaders["Content-Type"] = CoreChannel.BinaryMimeType;
- }
- }
- catch {
- processing = ServerProcessing.Complete;
- responseMsg = new ReturnMessage(new Exception(CoreChannel.GetResourceString("Remoting_nonClsCompliantException")), (IMethodCallMessage)(requestMsg == null ? new ErrorMessage() : requestMsg));
-
-
- CallContext.SetData("__ClientIsClr", true);
- responseStream = (MemoryStream)CoreChannel.SerializeBinaryMessage(responseMsg, _includeVersioning);
- CallContext.FreeNamedDataSlot("__ClientIsClr");
- responseStream.Position = 0;
- responseHeaders = new TransportHeaders();
-
- if (_protocol == Protocol.Http) {
- responseHeaders["Content-Type"] = CoreChannel.BinaryMimeType;
- }
- }
- finally {
- CallContext.FreeNamedDataSlot("__CustomErrorsEnabled");
- }
-
- return processing;
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, object state, IMessage msg, ITransportHeaders headers, Stream stream)
- {
- SerializeResponse(sinkStack, msg, ref headers, out stream);
- sinkStack.AsyncProcessResponse(msg, headers, stream);
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- private void SerializeResponse(IServerResponseChannelSinkStack sinkStack, IMessage msg, ref ITransportHeaders headers, out Stream stream)
- {
- BaseTransportHeaders responseHeaders = new BaseTransportHeaders();
- if (headers != null) {
-
- foreach (DictionaryEntry entry in headers) {
- responseHeaders[entry.Key] = entry.Value;
- }
- }
- headers = responseHeaders;
-
- if (_protocol == Protocol.Http) {
- responseHeaders.ContentType = CoreChannel.BinaryMimeType;
- }
-
- bool bMemStream = false;
- stream = sinkStack.GetResponseStream(msg, headers);
- if (stream == null) {
- stream = new ChunkedMemoryStream(CoreChannel.BufferPool);
- bMemStream = true;
- }
-
- bool bBashUrl = CoreChannel.SetupUrlBashingForIisSslIfNecessary();
- try {
- CallContext.SetData("__ClientIsClr", true);
- CoreChannel.SerializeBinaryMessage(msg, stream, _includeVersioning);
- }
- finally {
- CallContext.FreeNamedDataSlot("__ClientIsClr");
- CoreChannel.CleanupUrlBashingForIisSslIfNecessary(bBashUrl);
- }
-
- if (bMemStream)
- stream.Position = 0;
- }
-
-
- [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.Infrastructure, Infrastructure = true)]
- public Stream GetResponseStream