Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
WCF WebGet ResponseFormat Vs WebOperationContext.OutgoingResponse.ContentType_Wcf_Silverlight_Firefox - Fatal编程技术网

WCF WebGet ResponseFormat Vs WebOperationContext.OutgoingResponse.ContentType

WCF WebGet ResponseFormat Vs WebOperationContext.OutgoingResponse.ContentType,wcf,silverlight,firefox,Wcf,Silverlight,Firefox,使用WebGet属性之间有什么区别 [WebGet( ResponseFormat = WebMessageFormat.Xml )] 以及手动设置内容类型 WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml"; 我有一个Silverlight应用程序正在向WCF发出此请求。我正在查看流量,ClientAccessPolicy.xml文件的请求/响应在我看来完全相同 问题是,手动设置内容类型在所有

使用WebGet属性之间有什么区别

[WebGet( ResponseFormat = WebMessageFormat.Xml )] 以及手动设置内容类型

WebOperationContext.Current.OutgoingResponse.ContentType = "application/xml"; 我有一个Silverlight应用程序正在向WCF发出此请求。我正在查看流量,ClientAccessPolicy.xml文件的请求/响应在我看来完全相同

问题是,手动设置内容类型在所有浏览器中都可以正常工作,但使用WebGet将导致Silverlight应用程序无法仅连接到FireFox上的WCF服务。它适用于所有其他浏览器。同样,在FireFox中手动操作也可以很好地工作


在单元测试时,手动执行此操作是一个问题,因为WebOperationContext.Current在测试期间为null。

响应格式是关于。。。响应的格式:XML与JSON


ContentType是一个标头。希望它设置为与响应格式相对应的值。

使用WebMessageFormat.Xml也会将ContentType设置为application/Xml。但当它这样做时,Silverlight就不能再访问WCF服务了。我想知道WebGet的不同做法是什么导致了这种行为。我不知道,我不知道SilverLight。可以尝试WebMessageFormat.Xml并将ContentType设置为text/Xml