我正在尝试创建一个第三方应该有望消费的服务.
使用者与SOAP 1.1兼容,这就是我为服务器使用basicHttpBinding的原因.当提出实际请求时,服务器期望的内容类型似乎出现了问题.使用basicHttpBinding我不明白为什么服务器仍然需要'application/soap + xml',据我所知,这只是SOAP 1.2所要求的.
我已经使用过wireshark来弄清楚这两个人正在沟通的内容.请参阅下面的tcp流和设置.
任何帮助表示赞赏.
第三方应用请求
POST/HTTP/1.1
SOAPAction:http: //tempuri.org/ITestService/Hello
Content-Type:text/xml; 字符集= utf-8的
主持人:shdesktop:8000
内容长度:297
期待:100-继续
连接:关闭
WCF服务器响应
HTTP/1.1 415无法处理消息,因为内容类型为'text/xml; charset = utf-8'不是预期的类型'application/soap + xml; 字符集= UTF-8' .
内容长度:0
服务器:Microsoft-HTTPAPI/2.0
日期:2010年2月9日星期二14:03:19 GMT
连接:关闭
服务配置
<system.serviceModel>
<services>
<service behaviorConfiguration="behTestService" name="ConsoleApplication1.TestService">
<endpoint address="" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="TestService" binding="basicHttpBinding"
contract="ConsoleApplication1.ITestService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behTestService">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud) 我开发了一个GUI测试框架,可以按计划对我们公司网站进行集成测试.当某些内容失败时,它会截取桌面的屏幕截图等.这在专用Windows Server 2008上的登录用户上无人值守.
问题是在我已断开远程桌面会话的桌面上截取屏幕截图.我得到以下异常:
System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
at System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
at IntegrationTester.TestCaseRunner.TakeScreenshot(String name) in C:\VS2010\IntegrationTester\IntegrationTester\Config\TestCaseRunner.cs:line 144
at IntegrationTester.TestCaseRunner.StartTest() in C:\VS2010\IntegrationTester\IntegrationTester\Config\TestCaseRunner.cs:line 96
Run Code Online (Sandbox Code Playgroud)
该TakeScreenshot()方法是这样的:
public static void TakeScreenshot(string name)
{
var bounds = Screen.GetBounds(Point.Empty);
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
}
bitmap.Save("someFileName", ImageFormat.Jpeg);
}
}
Run Code Online (Sandbox Code Playgroud)
我确保屏幕保护程序设置为"无",没有超时.我还实现了一段代码,它可以执行一些pinvokes来发送鼠标移动,希望它能生成桌面图形处理..但是没有. …
我在我的应用程序中遇到了一些严重的内存泄漏,所以我设置了这个极其简单的解决方案来测试当String数组超出范围时会发生什么......
我知道String的旧TextString实现缺少析构函数,但是这个当前的实现似乎有它.
我正在使用这个MemoryFree库(请注意,此链接代码现已根据此问题的已接受答案进行修复).
该代码检查了两种情况:在两个不同的函数中分配char数组和字符串数组,以强制范围退出.
#include <MemoryFree.h>
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
int freeBefore, freeAfter;
//TEST ALLOCATION OF CHAR ARRAY//
freeBefore = freeMemory();
AllocateCharArr();
freeAfter = freeMemory();
Serial.println("CHAR*: Before " + String(freeBefore)
+ ", After " + String(freeAfter)
+ ", Diff " + String(freeBefore - freeAfter));
//TEST ALLOCATION OF STRING//
freeBefore = freeMemory();
AllocateStringArr();
freeAfter = freeMemory();
Serial.println("STRING: Before " + String(freeBefore)
+ ", After " + String(freeAfter)
+ …
Run Code Online (Sandbox Code Playgroud) 我们的目标
我们希望让我们的用户能够在他们开始输入时获得搜索建议,但 ElasticSearch 建议器没有提供任何似乎适合我们从文章中获取文本片段建议的用例。Ngramming 和搜索文档标题适用于标题很多且变化很大的索引,但对于少量文章,标题不能代表足够的信息,并且很多搜索短语返回零结果。我们也不能让用户用相关的建议线索标记所有文档。
我们的文档通常由标题和描述(正文)以及各种其他属性(如组、类别和部门)组成。
我们目前的解决方案:单独索引中的
shingles
每次我们索引文档时,我们都会调用elasticsearch _analyze端点来生成文档描述 + 标题的shingles (2-5)。然后将每个结果(带状疱疹产生大量结果)作为名为Suggestion的字段存储在新索引中原始文档的副本中。这是因为某些用户可能希望缩小对属于某个类别的文档的建议范围或我们提供的任何其他任意过滤选项。
原始文件(主索引):
{
"Title": "A fabulous document",
"Description": "A document with fabulous content"
"Category": "A"
}
Run Code Online (Sandbox Code Playgroud)
建议文件(Suggestion index)
(Suggestion 1)
{
"Title": "A fabulous document",
"Description": "A document with fabulous content",
"Category": "A"
"Suggestion": "A"
}
(Suggestion 2)
{
"Title": "A fabulous document",
"Description": "A document with fabulous content",
"Category": "A"
"Suggestion": "A document"
}
...
(Suggestion N)
{ …
Run Code Online (Sandbox Code Playgroud) .net ×2
c# ×2
arduino ×1
autocomplete ×1
c ×1
pinvoke ×1
search ×1
soap ×1
wcf ×1
web-services ×1