问题描述
所以我正在纯REST中测试Neo4J(没有Neo4JClient),并且我有以下代码:
So I'm testing Neo4J in pure REST (no Neo4JClient) and I have this code:
var client = new RestClient("http://url");
string requestText = "{ \"query\" : \"start x = node(1) match path = (x--IsFriendOf) return path, IsFriendOf.name\", \"params\" : { }}";
var request = new RestRequest();
request.Method = Method.POST;
request.RequestFormat = DataFormat.Json;
request.Resource = "/foo/bar";
request.AddHeader("Content-Length", requestText.Length.ToString());
request.AddHeader("Host", "ip:port");
request.AddHeader("Accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Basic encoded64credentials");
request.AddBody(requestText);
IRestResponse response = client.Execute(request);
如果我在Fiddler本身中执行RAW请求,则会得到所需的结果,
If I do the RAW request in Fiddler itself, I get the desired result,
但是,如果我在.Net 4.5的控制台应用程序中执行此操作,则会看到以下内容:
But if I do it in a console application in .Net 4.5, I see this:
我在防火墙中创建了一条规则,以允许对控制台可执行文件的传入/传出请求,并且我停用了IE保护模式,但仍然没有运气.
I created a rule in my firewall to allow incoming/outgoing requests for the console executable, and I deactivated IE protected mode, but still, no luck.
有人对这个问题有想法吗?
Do anyone have some idea about this issue?
推荐答案
这里有很多错误.
首先要了解的是,您根本没有真正看到请求-在此屏幕快照中显示的请求是IE下载的兼容性视图列表信息,而不是您自己创建的任何请求.
The first thing to understand is that you're not actually seeing the request at all-- the request you're showing in this screenshot is IE downloading Compatibility View List information, not any request you've made yourself.
您可能应该先阅读 http://blogs.msdn.com/b/fiddler/archive/2011/09/14/fiddler-and-windows-8-metro- style-applications-https-and-private-network-capabilities.aspx 了解Windows 8/Windows Server 2012的变化以及在本地环回代理中捕获其流量所需的操作.
You should probably start by reading http://blogs.msdn.com/b/fiddler/archive/2011/09/14/fiddler-and-windows-8-metro-style-applications-https-and-private-network-capabilities.aspx to understand how Windows 8 / Windows Server 2012 have changed and what you need to do to capture their traffic in a local loopback proxy.
这篇关于Windows Server 2012中的Fiddler4引发RestSharp请求为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!