我们有一个需要启用SSL的Delphi SOAP服务.我选择使用IIS ARR反向代理来进行SSL卸载以便于配置(与OpenSSL和手动证书+密码短语管理相比).ARR有效,但它增加了大量的开销...... 对于18个服务请求(总压缩约60Kb),响应时间从不到2秒变为19秒.
我将时间戳记录添加到客户端和服务器,以便在发送和接收消息时使用.它显示在从客户端发送和服务接收之间通过ARR向每个请求路由添加大约1秒.响应很快被路由回来,只有通过ARR的请求路由很慢(见下图).
如何跟踪开销的来源?ARR不适合这个用例吗?我尝试调整和禁用大多数设置,包括缓存.我尝试使用干净的IIS设置的不同主机,包括生产Windows Server 2012.SSL本身不是开销,只是让ARR HTTP反向代理导致延迟.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:8987/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
来自Fiddler的请求和回复样本:


编辑:我的(不完整和非常粗糙)XmlLite标题翻译在GitHub上可用
在不使用DOM的情况下,将Delphi中的大量XML文档与MSXML简单组合的最佳方法是什么?我应该使用COM组件SAXReader和XMLWriter吗?有什么好的例子吗?
转换是从根(Container)到许多大文件(60MB +)到一个巨大文件(~1GB)的所有Contents元素的简单组合.
<Container>
<Contents />
<Contents />
<Contents />
</Container>
Run Code Online (Sandbox Code Playgroud)
我使用XmlWriter和XmlReaders在以下C#代码中工作,但它需要在本机Delphi进程中进行:
var files = new string[] { @"c:\bigFile1.xml", @"c:\bigFile2.xml", @"c:\bigFile3.xml", @"c:\bigFile4.xml", @"c:\bigFile5.xml", @"c:\bigFile6.xml" };
using (var writer = XmlWriter.Create(@"c:\HugeOutput.xml", new XmlWriterSettings{ Indent = true }))
{
writer.WriteStartElement("Container");
foreach (var inputFile in files)
using (var reader = XmlReader.Create(inputFile))
{
reader.MoveToContent();
while (reader.Read())
if (reader.IsStartElement("Contents"))
writer.WriteNode(reader, true);
}
writer.WriteEndElement(); //End the Container element
}
Run Code Online (Sandbox Code Playgroud)
我们已经在系统的其他部分使用MSXML DOM,如果可能的话我不想添加新的组件.
有人可以对这种行为有所了解吗?看起来Delphi SOAP将函数结果设置为最后一个参数,但WSDL.exe将第一个参数作为函数结果读取.
我在Delphi SOAP服务中有以下方法,其中结果字符串用于基本错误处理:
function LoadCustomer(CustomerID: Double; out CustomerName: String): String;
Run Code Online (Sandbox Code Playgroud)
生成的WSDL如下所示:
<message name="LoadCustomer2Request">
<part name="CustomerID" type="xs:double"/>
</message>
<message name="LoadCustomer2Response">
<part name="CustomerName" type="xs:string"/>
<part name="return" type="xs:string"/>
</message>
Run Code Online (Sandbox Code Playgroud)
出于某种原因,WSDL.exe生成以下C#代码,用于交换CustomerName和'Result'字符串:
public string LoadCustomer(double CustomerID, out string @return) {
WindowsFormsApplication1.ServiceReference1.LoadCustomerRequest inValue = new WindowsFormsApplication1.ServiceReference1.LoadCustomerRequest();
inValue.CustomerID = CustomerID;
WindowsFormsApplication1.ServiceReference1.LoadCustomerResponse retVal = ((WindowsFormsApplication1.ServiceReference1.ISKiWebInterface)(this)).LoadCustomer(inValue);
@return = retVal.@return;
return retVal.CustomerName;
}
Run Code Online (Sandbox Code Playgroud) 在Silverlight中,System.Windows.Threading的Dispatcher.BeginInvoke()接受一个Action<T>或一个委托来调用.
.NET允许我只传递lambda表达式.但ReSharper将其视为错误,并说"无法解析方法'BeginInvoke(lambda expression)'": Dispatcher.BeginInvoke(() => { DoSomething(); })
如果我明确地创建这样Action的表达式,错误就会消失: Dispatcher.BeginInvoke(new Action<object>(o => { DoSomething(); }));
在这种情况下,我更喜欢最少量的代码以获得最佳可读性.有没有办法禁用此特定的ReSharper错误通知?我尝试了一些选项,但找不到它.
谢谢,卡尔
我正在努力为我的C#枚举生成正确的WSDL命名空间,ContractNamespace而不是使用属性装饰每个类型.
以下代码Person在" http://www.mynamespace.co.za/ "中正确生成类型,但出于某种原因Gender在不同的WSDL名称空间中," http://schemas.datacontract.org/2004/07/SomeOtherNamespace ".
我错过了什么?enums需要特殊处理吗?
[assembly: ContractNamespace("http://www.mynamespace.co.za/", ClrNamespace = "SomeOtherNamespace")]
namespace SomeOtherNamespace
{
public class Person
{
public int Age { get; set; }
public Gender Gender { get; set; }
}
public enum Gender
{
Male,
Female,
Other
}
}
Run Code Online (Sandbox Code Playgroud)
在我的实际代码中,类型存在于外部生成的程序集中.使用自定义属性无法轻松修饰类型.ContractNamespace如果它也适用于枚举,那将是完美的...
换句话说,以下工作,但进入代码生成过程将非常痛苦.
[DataContract(Namespace = "http://www.mynamespace.co.za/")]
public enum Gender
{
[EnumMember]
Male,
[EnumMember]
Female,
[EnumMember]
Other
}
Run Code Online (Sandbox Code Playgroud) 我正在使用嵌入式脚本的VCL(Delphi Win32)表单应用程序平台,并希望添加调试支持.脚本在主VCL线程中执行 - 脚本执行直接UI操作,并具有一些其他遗留约束,将其保留在UI线程中.
调试器UI需要在自己的线程中运行,因为主UI线程将阻塞脚本断点.它仍然需要在线程安全的调试组件的相同过程中才能工作.
我试图关注Blorgbeard对/sf/answers/875417161/的评论,但我不确定这是否可以用Delphi的VCL.(.NET在将表单传递给Application.Run时创建一个新的ApplicationContext)使用以下Delphi,阻止主UI线程会停止第二个线程上的消息处理(反之亦然).
procedure TDebuggerThread.Execute;
begin
CoInitialize(nil);
FForm := TForm2.Create(nil);
FForm.Show;
Application.Run;
end;
Run Code Online (Sandbox Code Playgroud)