将视频数据发送到WCF Restful服务作为POST

时间:2022-12-29 19:36:08

I was having a problem sending video data to a WCF restful service using post, my contract looks like this

我在使用post将视频数据发送到WCF restful服务时出现问题,我的合同看起来像这样

 [OperationContract]
    [WebInvoke(Method = "POST",
                 ResponseFormat=WebMessageFormat.Json,
               BodyStyle = WebMessageBodyStyle.Wrapped,
               UriTemplate = "UploadMovie")]
    string UploadMovie(Stream stream);

This works ok when I'm sending some text data but does not work when I attempt to send Video data, I have some exception catching in place but it seems like the request is not even being processed, since I get no response and no exceptions get logged... anyone have any input on this?

当我发送一些文本数据但在我尝试发送视频数据时不起作用时,这可以正常工作,我有一些异常捕获,但似乎请求甚至没有被处理,因为我得不到响应,没有例外得到记录......任何人都对此有任何意见?

3 个解决方案

#1


you can use the svclog app to determine exactly what is happening. You just have enable wcf logging

您可以使用svclog应用程序确切地确定发生了什么。您只需启用wcf日志记录

http://wcfsecurity.codeplex.com/Wiki/View.aspx?title=How%20to%20enable%20WCF%20message%20logging

If you are instantiating all wcf in code, you can just add an app.config with the correct information to your code directory and this will work. Just remember to take it out when you're done. Most likely you have some exception that the WCF framework is catching. That happened to me on a message that seemingly vanished into thin air.

如果要在代码中实例化所有wcf,只需将带有正确信息的app.config添加到代码目录中即可。记得在你完成后把它拿出来。很可能你有一些WCF框架正在捕获的异常。这发生在我身上的消息似乎消失得无影无踪。

#2


Check out this post on streaming in Restful WCF. It's reverse of what you want to do, but using the AdapterStream class will probably help.

在Restful WCF中查看关于流媒体的这篇文章。它与您想要做的相反,但使用AdapterStream类可能会有所帮助。

#3


The problem was the buffer size, i ended up splitting the video up into chunks and sending it like that, thanks everyone for their input

问题是缓冲区大小,我最终将视频分成块并发送它,感谢大家的输入

#1


you can use the svclog app to determine exactly what is happening. You just have enable wcf logging

您可以使用svclog应用程序确切地确定发生了什么。您只需启用wcf日志记录

http://wcfsecurity.codeplex.com/Wiki/View.aspx?title=How%20to%20enable%20WCF%20message%20logging

If you are instantiating all wcf in code, you can just add an app.config with the correct information to your code directory and this will work. Just remember to take it out when you're done. Most likely you have some exception that the WCF framework is catching. That happened to me on a message that seemingly vanished into thin air.

如果要在代码中实例化所有wcf,只需将带有正确信息的app.config添加到代码目录中即可。记得在你完成后把它拿出来。很可能你有一些WCF框架正在捕获的异常。这发生在我身上的消息似乎消失得无影无踪。

#2


Check out this post on streaming in Restful WCF. It's reverse of what you want to do, but using the AdapterStream class will probably help.

在Restful WCF中查看关于流媒体的这篇文章。它与您想要做的相反,但使用AdapterStream类可能会有所帮助。

#3


The problem was the buffer size, i ended up splitting the video up into chunks and sending it like that, thanks everyone for their input

问题是缓冲区大小,我最终将视频分成块并发送它,感谢大家的输入