Skip to content

Commit f28a549

Browse files
committed
Allow disabling security fix on the command line.
1 parent 0a2aae3 commit f28a549

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

ExampleRemotingService/App.config

Lines changed: 0 additions & 8 deletions
This file was deleted.

ExampleRemotingService/ExampleRemotingService.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<HintPath>..\packages\NDesk.Options.0.2.1\lib\NDesk.Options.dll</HintPath>
4040
</Reference>
4141
<Reference Include="System" />
42+
<Reference Include="System.Configuration" />
4243
<Reference Include="System.Runtime.Remoting" />
4344
<Reference Include="System.Data" />
4445
<Reference Include="System.Xml" />
@@ -48,7 +49,6 @@
4849
<Compile Include="Properties\AssemblyInfo.cs" />
4950
</ItemGroup>
5051
<ItemGroup>
51-
<None Include="App.config" />
5252
<None Include="packages.config" />
5353
</ItemGroup>
5454
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

ExampleRemotingService/Program.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
using System;
1818
using System.Collections;
19+
using System.Configuration;
1920
using System.Diagnostics;
21+
using System.Reflection;
2022
using System.Runtime.Remoting;
2123
using System.Runtime.Remoting.Channels;
2224
using System.Runtime.Remoting.Channels.Ipc;
@@ -32,6 +34,11 @@ class RemoteType : MarshalByRefObject
3234
{
3335
}
3436

37+
static void SetAllowTransparentProxy(bool allow)
38+
{
39+
ConfigurationManager.AppSettings.Set("microsoft:Remoting:AllowTransparentProxyMessage", allow.ToString());
40+
}
41+
3542
static void Main(string[] args)
3643
{
3744
try
@@ -43,6 +50,7 @@ static void Main(string[] args)
4350
TypeFilterLevel typefilter = TypeFilterLevel.Low;
4451
CustomErrorsModes custom_errors = CustomErrorsModes.Off;
4552
string name = "RemotingServer";
53+
bool disable_transparent_proxy_fix = false;
4654

4755
OptionSet p = new OptionSet() {
4856
{ "s|secure", "Enable secure mode", v => secure = v != null },
@@ -53,6 +61,7 @@ static void Main(string[] args)
5361
{ "e|error=", "Set custom error mode (On, Off, RemoteOnly) (don't show full errors in remote calls)",
5462
v => custom_errors = (CustomErrorsModes)Enum.Parse(typeof(CustomErrorsModes), v, true) },
5563
{ "n|name=", "Set the remoting class name", v => name = v },
64+
{ "d", "Disable the 'AllowTransparentProxyMessage' setting fix.", v => disable_transparent_proxy_fix = v != null },
5665
{ "h|?|help", v => showhelp = v != null },
5766
};
5867

@@ -66,6 +75,7 @@ static void Main(string[] args)
6675
}
6776
else
6877
{
78+
SetAllowTransparentProxy(!disable_transparent_proxy_fix);
6979
RemotingConfiguration.CustomErrorsMode = custom_errors;
7080

7181
Trace.Listeners.Add(new ConsoleTraceListener(true));

0 commit comments

Comments
 (0)