我通过SSL连接到IIS REST服务的设备出现间歇性错误.我的应用程序运行正常,但有时我得到这个例外.它处理得很好,并没有降低应用程序..
我想知道这意味着什么,有没有办法解决它?目前,它会导致数据检索延迟.此外,它泛滥日志,我不能真的忽略它..我想知道我是否可以改善这种情况.
当我处理REST服务时,这是我应该期待的吗?我的服务器在Amazon EC2上.
读取错误:ssl = 0x1211a88:系统调用期间的I/O错误,通过对等方重置连接
javax.net.ssl.SSLException:读取错误:ssl = 0x1211a88:系统调用期间的I/O错误,在org处的org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(本机方法)中由对等方重置连接.位于org.apache.harmony.xnet.provider.jsse的libcore.io.Streams.readSingleByte(Streams.java:41)上的apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl $ SSLInputStream.read(OpenSSLSocketImpl.java:671).位于libcore.net.http的libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:544)上的libcore.io.Streams.readAsciiLine(Streams.java:201)中的OpenSSLSocketImpl $ SSLInputStream.read(OpenSSLSocketImpl.java:655) .httpEngine.readResponse(HttpEngine.java:784)位于libcore.net的libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)libcore.net.http.HttpURLConnectionImpl.getResponseMessage(HttpURLConnectionImpl.java:475). http.HttpsURLConnectionImpl.getResponseMessage
这不是我可以重现的东西.没有权限或像这样的东西.这是间歇性的问题.我每天看到大约有1000台设备连接每分钟200台设备.
我在数据库中有一个日期时间,我使用Entity Framework从数据库中检索它,然后我通过DataContractJsonSerializer通过JSON API传递数据.
在DataContractJsonSerializer中处理时,日期时间字段中的时间似乎已根据服务器的本地时区进行了调整.该时期表示时间比预期时间提前1小时.DateTime种类是UTC,但以前它是未指定的,我有同样的问题.
在我的应用程序中,我希望明确地在客户端而不是服务器之间转换时区,因为这更有意义.我对这个隐含功能感到惊讶,因为我的日期时间值应该是一个简单的值,就像一个整数.
谢谢
我一直在使用ASP.Net成员资格/角色提供程序在WCF 4.0 RESTfull服务中使用用户名/密码身份验证/授权.
花了两天时间试图找到大多数人都同意的东西,我放弃了.很多混乱似乎是因为专门针对WCF 4.0的信息很少.
有人可以善待
编辑:赏金的人谁可以为用户提供用户名/密码认证和授权使用WCF服务应用程序模板在VS 2010中一个问题的REST WCF服务4.0的完整样本(甚至只是一个完整样本的链接).
我已经尝试了每个组合来发送请求从jQuery向RESTful WCF发送POST请求.
有人可以模仿并使其发挥作用.代码在这里:http://pastebin.com/Ua97919C
我在过去2年与WCF合作,但每次发送POST请求都会让我很烦恼.
我努力让它在过去的4天里工作,并且经历了至少35-40个帖子.
最终,此请求将从iPhone发送到WCF.
当我用Fiddler检查时,错误主要是:*服务器遇到处理请求的错误.异常消息是'传入消息具有意外的消息格式'Raw'.操作的预期消息格式是'Xml','Json'.这可能是因为尚未在绑定上配置WebContentTypeMapper.有关更多详细信息,请参阅WebContentTypeMapper的文档.请参阅服务器日志以获取更多详 异常堆栈跟踪是:at
System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
Run Code Online (Sandbox Code Playgroud) 我正在寻找任何文章或论坛帖子,在那里我可以找到有关如何进行oauth 2.0身份验证的信息.特别是我有MVC 3应用程序和WCF Restfull API.我必须使用oauth 2.0协议身份验证从Web应用程序调用API方法.但我找不到任何有关它的信息.谷歌搜索后,我只看到如何开发facebook,linkedin,google等客户端的结果..任何帮助都会有所帮助.谢谢.
我的主要问题是如何传递JSON以及File以将请求发送到REST API?Spring框架需要什么才能作为客户端工作并通过使用JSON和File传递帖子来等待响应?
选项:
还有其他选择吗?
我正在使用RestClient应用程序与我的WCF服务进行通信.我收到以下异常
The underlying connection was closed: An unexpected error occurred on a receive.
Run Code Online (Sandbox Code Playgroud)
这是我使用的C#代码
string q = string.Format(@"xxxxxxxxxxxxxxxxxxxxxxxxxxx");
WebClient client = new WebClient();
string Url = string.Format("{0}/Get?queries={1}", BaseUrl,HttpUtility.UrlEncodeUnicode(q));
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
var result = client.DownloadString(Url);
Console.WriteLine("======================output================================");
Console.WriteLine(result);
Console.WriteLine("===========================================");
Run Code Online (Sandbox Code Playgroud)
这是错误消息
System.Net.WebException was caught
HResult=-2146233079
Message=The underlying connection was closed: An unexpected error occurred on a receive.
Source=System
StackTrace:
at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
at System.Net.WebClient.DownloadString(Uri address)
at System.Net.WebClient.DownloadString(String address)
at RestClient.Program.GetRecordsTest() in C:\Users\Wiemon\Downloads\RestAppClient\RestAppClient\Program.cs:line 118
InnerException: System.IO.IOException
HResult=-2146232800
Message=Unable to read data from …Run Code Online (Sandbox Code Playgroud) 我在这里有两个问题: -
1)两者之间的基本区别是什么 Microsoft.ServiceModel.Web.RequestInterceptor and System.ServiceModel.Dispatcher.DispatchRuntime.MessageInspectors (IdispatchMessageInterceptor)
两者似乎都是请求/消息拦截器,可用于在请求管道中实现自定义验证/拦截器.
什么时候使用另一个?
2)亦如何插件RequestInterceptor在RouteTable.Routes.Add(new ServiceRoute())
我有这样的课 -
public class AuthenticationInterceptor : RequestInterceptor
{
//Authentication logic goes here......
}
Run Code Online (Sandbox Code Playgroud)
和这样的路线定义: -
RouteTable.Routes.Add(new ServiceRoute(routePrefix, new MyServiceHostFactory(container, (sh) => {
foreach (System.ServiceModel.Dispatcher.ChannelDispatcher cd in sh.ChannelDispatchers)
{
foreach (System.ServiceModel.Dispatcher.EndpointDispatcher ed in cd.Endpoints)
{
ed.DispatchRuntime.MessageInspectors.Add(new AuthenticationInterceptor());
}
}
return sh; })));
Run Code Online (Sandbox Code Playgroud)
这是以下定义MyServiceHostFactory: -
public MyServiceHostFactory(IocContainer container, Func<ServiceHost, ServiceHost> createservicehost = null);
Run Code Online (Sandbox Code Playgroud)
现在它抛出以下错误: -
The best overloaded method match for 'System.Collections.Generic.SynchronizedCollection<System.ServiceModel.Dispatcher.IDispatchMessageInspector>.Add(System.ServiceModel.Dispatcher.IDispatchMessageInspector)' has some invalid arguments …
我正在使用WCF REST stater工具包来构建一个简单的xml over HTTP服务.作为这个Im的一部分,我使用RequestInterceptor进行身份验证.在RequestInterceptor内部,我可以访问System.ServiceModel.Channels.RequestContext对象,从中可以获取请求url,querystring params和其他有用的东西.我无法解决的是如何访问请求的HttpContext.我有几个东西存储在HttpContext中,我想在requestInterceptor中访问但是我很难找到它们.当我在Visual Studio中使用quickwatch时,我可以看到它隐藏在requestContext的私有成员中.有人可以告诉我如何访问HttpContext,也许使用RequestContext对象上的反射?
我正在尝试为我的Web服务编写XML响应,但是我无法弄清楚如何使声明出现在响应中.
我的代码是这样的:
StringBuilder sBuilder = new StringBuilder();
using (XmlWriter writer = XmlWriter.Create(sBuilder))
{
writer.WriteStartDocument();
writer.WriteStartElement("ReportResponse");
Response.WriteXml(writer);
writer.WriteEndElement();
writer.WriteEndDocument();
}
var response = XElement.Parse(sBuilder.ToString());
return response;
Run Code Online (Sandbox Code Playgroud)
响应只是存储响应数据的POCO.
我知道该Save方法包括声明而ToString()方法没有.我需要写回我的声明ToString().
我真的只想从我的REST服务返回自定义XML而不将我的字符串强制转换100次以返回有效的XML.这甚至可能还是只是旋转我的车轮?