C# AFNetworking+WCF流媒体未按预期工作(所有数据都在客户端缓冲)
因此,在经历了大量的尝试之后,从RESTKit到基本AFNetworking,我们仍然无法像预期的那样让流媒体工作 我们正在将文件流式传输到WCF服务器:C# AFNetworking+WCF流媒体未按预期工作(所有数据都在客户端缓冲),c#,objective-c,wcf,afnetworking,C#,Objective C,Wcf,Afnetworking,因此,在经历了大量的尝试之后,从RESTKit到基本AFNetworking,我们仍然无法像预期的那样让流媒体工作 我们正在将文件流式传输到WCF服务器: RKObjectManager* manager = [RKObjectManager sharedManager]; // Build the request NSMutableURLRequest* request = [manager.HTTPClient requestWithMethod:@"PUT" path:action pa
RKObjectManager* manager = [RKObjectManager sharedManager];
// Build the request
NSMutableURLRequest* request = [manager.HTTPClient requestWithMethod:@"PUT" path:action parameters:nil];
// note - this method inserts all parameters to the URL. so we will construct a new URL and add the parameters
// this line is taken from AFNetworking.
// we set the file name in the URL
NSURL* url = [NSURL URLWithString:[[request.URL absoluteString] stringByAppendingFormat:[action rangeOfString:@"?"].location == NSNotFound ? @"?%@" : @"&%@", AFQueryStringFromParametersWithEncoding(params, manager.HTTPClient.stringEncoding)]];
[request setURL:url];
// all requests will have a stream type (as we are posting raw data)
[request setValue:[NSString stringWithFormat:@"application/octet-stream"] forHTTPHeaderField:@"Content-Type"];
// we are overriding any body that the request added - because we want the whole rawData to be sent as a body. Data streaming.
[request setHTTPBodyStream:dataStream];
// Set the upload timeout
[request setTimeoutInterval:999999];
AFHTTPRequestOperation* httpOp =[manager.HTTPClient HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"sucesS");
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Failure");
}];
[httpOp setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
NSLog(@"uploading..");
}];
[manager.HTTPClient enqueueHTTPRequestOperation:httpOp];
我看到代理立即被调用,写入的字节不断增加。
但是服务器没有收到任何东西
调用success之后,服务器才开始处理该文件
我们的服务器端web配置:
<endpoint address="Upload" binding="webHttpBinding" bindingConfiguration="webUploadHttpBindingConfig" behaviorConfiguration="web" contract="IREST" />
...
<binding name="webUploadHttpBindingConfig" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
</binding>
在服务器代码中,我们创建文件并将其流式传输到磁盘
我在拔头发,这里少了什么
谢谢。您应该进行更新,而不是创建一个有效的重复问题。您是否检查了服务器缓冲和日志?maxBufferSize做什么?@Wain-另一个谈论超时。我将删除那个问题。maxBufferSize=2147483647服务器上没有日志,IIS甚至在IPAD中完成缓冲之前都不会收到请求。您是否使用Charles查看发送的内容和时间?@Wain-我无法让它运行。我们的服务器没有传出的internet连接,我没有太多时间开始安装新的。我想虽然我已经添加了我们所有的东西,从客户端代码到服务器代码和web配置。。