DebugConfig - EnableAutoRemoteDebugging
This commit is contained in:
@@ -42,6 +42,8 @@ namespace BeWo
|
||||
/// </summary>
|
||||
public int? SelectIndex { get; set; }
|
||||
|
||||
public bool EnableAutoRemoteDebugging { get; set; }
|
||||
|
||||
public static DebugConfig SimpleAutoLogin => new DebugConfig()
|
||||
{
|
||||
DebugConfigMode = DebugConfigMode.SimpleAutoLogin,
|
||||
@@ -125,9 +127,10 @@ namespace BeWo
|
||||
AutoLogin = true,
|
||||
SelectView = UIContext.Finance,
|
||||
SelectIndex = 8,
|
||||
//Username = "m1",
|
||||
//Password = "bewobewo",
|
||||
//Profilename = "5000000000"
|
||||
Username = "m1",
|
||||
Password = "bewobewo",
|
||||
Profilename = "5000000000",
|
||||
EnableAutoRemoteDebugging = true
|
||||
});
|
||||
|
||||
return name2config;
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace BeWo.ServiceProxy
|
||||
{
|
||||
public static object _Lock = string.Empty;
|
||||
|
||||
private static string _ServerName;
|
||||
private static Dictionary<Type, EndpointAddress> _EndpointAddresses;
|
||||
|
||||
private static readonly Dictionary<Type, object> _ProxyCache;
|
||||
@@ -39,26 +40,26 @@ namespace BeWo.ServiceProxy
|
||||
|
||||
public static void UpdateServerAddresses(String siteOfOrigin)
|
||||
{
|
||||
_ServerName = siteOfOrigin;
|
||||
var test = _ServerName.Substring(_ServerName.Length - 1, 1);
|
||||
if (_ServerName.Substring(_ServerName.Length - 1, 1) != "/")
|
||||
_ServerName += "/";
|
||||
|
||||
String serverName = siteOfOrigin;
|
||||
var test = serverName.Substring(serverName.Length - 1, 1);
|
||||
if (serverName.Substring(serverName.Length - 1, 1) != "/")
|
||||
serverName += "/";
|
||||
_EndpointAddresses = new Dictionary<Type, EndpointAddress>
|
||||
{
|
||||
{ typeof(IQueryService), new EndpointAddress(serverName + "QueryService.svc") },
|
||||
{ typeof(IStreamingService), new EndpointAddress(serverName + "StreamingService.svc") },
|
||||
{ typeof(IEmployeeService), new EndpointAddress(serverName + "EmployeeService.svc") },
|
||||
{ typeof(ICustomerService), new EndpointAddress(serverName + "CustomerService.svc") },
|
||||
{ typeof(IUserService), new EndpointAddress(serverName + "UserService.svc") },
|
||||
{ typeof(IValueListService), new EndpointAddress(serverName + "ValueListService.svc") },
|
||||
{ typeof(IDownloadService), new EndpointAddress(serverName + "DownloadService.svc") },
|
||||
{ typeof(IResourceService), new EndpointAddress(serverName + "ResourceService.svc") },
|
||||
{ typeof(IOperationsService), new EndpointAddress(serverName + "OperationsService.svc") },
|
||||
{ typeof(IAnalysisService), new EndpointAddress(serverName + "AnalysisService.svc") },
|
||||
{ typeof(IMailService), new EndpointAddress(serverName + "MailService.svc") },
|
||||
{ typeof(IAccountingService), new EndpointAddress(serverName + "AccountingService.svc") },
|
||||
{ typeof(IReportService), new EndpointAddress(serverName + "ReportService.svc") }
|
||||
{ typeof(IQueryService), new EndpointAddress(_ServerName + "QueryService.svc") },
|
||||
{ typeof(IStreamingService), new EndpointAddress(_ServerName + "StreamingService.svc") },
|
||||
{ typeof(IEmployeeService), new EndpointAddress(_ServerName + "EmployeeService.svc") },
|
||||
{ typeof(ICustomerService), new EndpointAddress(_ServerName + "CustomerService.svc") },
|
||||
{ typeof(IUserService), new EndpointAddress(_ServerName + "UserService.svc") },
|
||||
{ typeof(IValueListService), new EndpointAddress(_ServerName + "ValueListService.svc") },
|
||||
{ typeof(IDownloadService), new EndpointAddress(_ServerName + "DownloadService.svc") },
|
||||
{ typeof(IResourceService), new EndpointAddress(_ServerName + "ResourceService.svc") },
|
||||
{ typeof(IOperationsService), new EndpointAddress(_ServerName + "OperationsService.svc") },
|
||||
{ typeof(IAnalysisService), new EndpointAddress(_ServerName + "AnalysisService.svc") },
|
||||
{ typeof(IMailService), new EndpointAddress(_ServerName + "MailService.svc") },
|
||||
{ typeof(IAccountingService), new EndpointAddress(_ServerName + "AccountingService.svc") },
|
||||
{ typeof(IReportService), new EndpointAddress(_ServerName + "ReportService.svc") }
|
||||
};
|
||||
|
||||
}
|
||||
@@ -844,6 +845,23 @@ namespace BeWo.ServiceProxy
|
||||
_ProxyCache.Add(typeof(TClient), lClient);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (DebugConfig.CurrentConfig is DebugConfig current && current.EnableAutoRemoteDebugging)
|
||||
{
|
||||
if (lClient.Endpoint.Binding is BasicHttpBinding binding)
|
||||
{
|
||||
if(_ServerName.StartsWith("https"))
|
||||
{
|
||||
binding.Security.Mode = BasicHttpSecurityMode.Transport;
|
||||
}
|
||||
else
|
||||
{
|
||||
binding.Security.Mode = BasicHttpSecurityMode.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lClient.Endpoint.Behaviors.Add(new SecurityHeaderEndpointBehavior());
|
||||
lClient.Endpoint.Behaviors.Add(new MultitenancyEndpointBehavior());
|
||||
|
||||
Reference in New Issue
Block a user