- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在使用 C# 和 .NET Framework 4.0 开发 WCF 服务。
我正在使用 webHttpBinding
来执行此操作:
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "filteredOrders/")]
OrderContract[] GetOrders(IdsMessage msg);
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "completeFilteredOrders/")]
OrderContract[] LoadCompleteFilteredOrders(IdsMessage msg);
但现在我需要使用流传输将图像发送到该 Web 服务,并且我需要添加 basicHttpBinding
来完成它。
我如何为这个使用 basicHttpBinding
的 WCF Web 服务创建一个新的 [OperationContract]
?
抱歉,我对 WCF 开发还很陌生。
顺便说一句,这是我的Web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="EReportService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" contract="EReportService.IRestServiceImpl" behaviorConfiguration="web">
</endpoint>
</service>
</services>
<bindings>
<webHttpBinding>
<binding maxReceivedMessageSize="2097152" maxBufferSize="2097152" transferMode="Streamed"/>
</webHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<connectionStrings>
</connectionStrings>
</configuration>
最佳答案
只需使用不同的地址创建另一个端点(两个端点不能共享相同的地址)- 您可以修改现有的 OperationContract
以创建非 RESTful 方法。
<system.serviceModel>
<services>
<service name="EReportService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" contract="EReportService.IRestServiceImpl" behaviorConfiguration="web">
</endpoint>
<endpoint address="soap" binding="basicHttpBinding" contract="EReportService.IRestServiceImpl" >
</endpoint>
</service>
</services>
</system.serviceModel>
关于c# - basicHttpBinding 和 webHttpBinding 在一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13611928/
我正在尝试将客户端证书应用于 WCF REST 服务。我发现了一些有关应用具有以下内容的客户端证书的详细信息: 在这种
我创建了一个 Web 服务,我试图为其提供 3 个具有不同绑定(bind)的端点。 1.基本的HttpBinding, 2.wsHttpBinding, 3.webHttpBinding 当我进行服务
我已经创建了一个 RESTful 服务并实现了身份验证。它接受用户名和密码,然后授予对所请求服务的访问权限。它工作正常。现在我想在我的服务之上使用 SSL。为此我创建了证书,然后在 IIS 中我给出了
在我的 WCF 服务中,我试图通过 SSL 连接使用 JSON 将数据发送到客户端。我能够使用 wsHttpBinding 和 Transport 安全模式将 OData 数据库源保护到我的客户端。为
会不会像 [OperationContract] [WebGet] string IWannaRead(int[] ids); 工作?以及如何为请求形成链接\url (www.
我有一个 WCF REST 服务。我想为操作编写集成测试。我正在考虑使用 HttpWebRequest 来编写这些内容(如 Why does my C# client, POSTing to my W
我正在使用 Android 客户端将文件上传到 wcf 服务。上传工作正常,但现在我想在请求中获取文件名和另一个整数参数。 我该怎么做? afaik,我不能使用消息协定,因为我没有将消息打包为 SOA
引用我的previous question ,我想知道如果该服务仅公开一个使用 webHttpBinding 的端点,我将如何从客户端应用程序中提取 WCF 服务的信息以了解公开了哪些方法/类型? 总
我是 WCF RESTFull 服务开发的新手,我正在寻找一些有用的信息以及与新的 WCF Web API http://wcf.codeplex.com/ 相比使用 webHttpBinding 的
关于这个问题有很多讨论,但是我现在已经尝试了所有可能的解决方案,但我们仍然从服务器收到 413 Request Entity Too Large 错误。 我们的 WCF 服务是通过 Azure Wor
关于这个问题有很多讨论,但是我现在已经尝试了所有可能的解决方案,但我们仍然从服务器收到 413 Request Entity Too Large 错误。 我们的 WCF 服务是通过 Azure Wor
我正在使用 C# 和 .NET Framework 4.0 开发 WCF 服务。 我正在使用 webHttpBinding 来执行此操作: [OperationContract] [WebInvoke
我添加了对“System.ServiceModel”库的引用,但“WebHttpBinding”类不在其中。根据文档,它应该在那里 ( WebHttpBinding )。我在 3.5 和 4.0 框架
我有一个 REST WCF 服务。它使用 webHttpBinding 并且配置如下所示: CustomMapper 用于应用自定义 WebContentTypeMapper,我尝试如下
在引用 .NET 4.0 的 System.ServiceModel 和 System.ServiceModel.Web 库时,我无法实例化 WebHttpBinding 类。我可以在引用 3.5 库
我创建了一个 WCF 服务并公开了三个端点,它们是 basicHttpBinding、wsHttpBinding 和 webHttpBinding。这是我使用 WCF 进行实验的测试服务。但是,每当我
我正在尝试为网站使用 https 和 http。该网站具有充当 REST 服务并从 JavaScript 调用的 .svc 文件。 我的配置:
我正在开发 WPF 需要认证的应用程序。我想用客户端应用服务使用 ASP.Net 成员(member)提供商 (如果您不知道我在说什么,请参阅此 link)。实际上,我基于 MembershipPro
在 WCF 中,有几种不同类型的基于 HTTP 的绑定(bind): BasicHttpBinding WsHttpBinding WebHttpBinding 这三个有什么区别? 特别是在功能/性能
我正在尝试使用默认的 WebHttpBinding 绑定(bind) POST 到 REST 服务。该服务仅接受“text/xml”作为内容类型,WebHttpBinding 正在发送“applica
我是一名优秀的程序员,十分优秀!