WCF服务类中有一个返回值类型为Stream的方法
[ServiceContract] public interface IDMADBQueryServices { [OperationContract] Stream GetTopic(string topicID);
}
借口实现为:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] public class DMADBQueryService:IDMADBQueryServices {
public Stream GetTopic(string topicID) { return new MemoryStream(); } }
配置文件为:
<system.serviceModel>
<bindings> <basicHttpBinding> <binding name="bind1" maxReceivedMessageSize="90000000" transferMode="Streamed" /> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="DMADBQueryServices.Service1Behavior" name="DMADBQueryServices.DMADBQueryService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="bind1" contract="DMADBQueryServices.IDMADBQueryServices" > <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8732/Design_Time_Addresses/DMADBQueryServices/Service1/" /> </baseAddresses> </host> </service> </services> <behaviors> <serviceBehaviors> <behavior name="DMADBQueryServices.Service1Behavior"> <serviceMetadata httpGetEnabled="True"/> <serviceDebug includeExceptionDetailInFaults="False" /> </behavior> </serviceBehaviors> </behaviors>
</system.serviceModel>
现在运行服务,在WCF TEST工具中这个方法显示:
this operation is not supported in the wcf test because it use type system.io.stream
- 2 回答
- 0 关注
- 451 浏览
添加回答
举报
0/150
提交
取消