Skip to content

Commit

Permalink
Set MaxReceivedMessageSize for NetNamedPipeBinding to 16MB fixes issue
Browse files Browse the repository at this point in the history
  • Loading branch information
amaitland committed May 28, 2014
1 parent 8879e41 commit 85ef366
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CefSharp.Core/ManagedCefBrowserAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,13 @@ namespace CefSharp
if (browser != nullptr &&
frame != nullptr)
{
auto binding = gcnew NetNamedPipeBinding();
binding->MaxReceivedMessageSize = SubProcessProxySupport::MaxReceivedMessageSize;
// TODO: Don't instantiate this on every request. The problem is that the CefBrowser is not set in our constructor.
auto serviceName = SubProcessProxySupport::GetServiceName(Process::GetCurrentProcess()->Id, _renderClientAdapter->GetCefBrowser()->GetIdentifier());
auto channelFactory = gcnew DuplexChannelFactory<ISubProcessProxy^>(
this,
gcnew NetNamedPipeBinding(),
binding,
gcnew EndpointAddress(serviceName)
);

Expand Down
5 changes: 5 additions & 0 deletions CefSharp/Internals/SubProcessProxySupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ public class SubProcessProxySupport
{
private const string BaseAddress = "net.pipe://localhost";
private const string ServiceName = "CefSharpSubProcessProxy";

/// <summary>
/// MaxReceivedMessageSize - 16MB in bytes
/// </summary>
public const int MaxReceivedMessageSize = 16777216;

public static string GetServiceName(int parentProcessId, int browserId)
{
Expand Down
2 changes: 1 addition & 1 deletion CefSharp/Internals/SubProcessServiceHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static SubProcessServiceHost Create(int parentProcessId, int browserId)
Kernel32.OutputDebugString("Setting up IJavascriptProxy using service name: " + serviceName);
host.AddServiceEndpoint(
typeof(ISubProcessProxy),
new NetNamedPipeBinding(),
new NetNamedPipeBinding { MaxReceivedMessageSize = SubProcessProxySupport.MaxReceivedMessageSize },
new Uri(serviceName)
);

Expand Down

0 comments on commit 85ef366

Please sign in to comment.