- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我们有一个在 HTTPS 上运行良好但在 HTTPS 上显示 HTTP 415 错误的网络服务。因此,在 HTTP 下,我们可以毫无问题地发送和接收 JSON 的 POST 请求。当我们在 HTTPS 下尝试相同的操作时,我们收到错误消息,即服务需要 text/xml 而不是 application/json。有什么关于去哪里看的建议吗?
如果重要的话,服务器正在使用自签名证书。
更新了绑定(bind)和行为
<!-- Wcf Services Setting -->
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WsHttpBinding" maxReceivedMessageSize="1048576">
<readerQuotas maxArrayLength="1048576" />
</binding>
<binding name="SecureWsHttpBinding" maxReceivedMessageSize="1048576">
<readerQuotas maxArrayLength="1048576" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
<webHttpBinding>
<binding name="WebHttpBinding" maxReceivedMessageSize="1048576">
<readerQuotas maxArrayLength="1048576" />
</binding>
<binding name="SecureWebHttpBinding" maxReceivedMessageSize="1048576">
<readerQuotas maxArrayLength="1048576" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMainService" maxReceivedMessageSize="1048576"></binding>
<binding name="BasicHttpBinding" maxReceivedMessageSize="1048576">
<readerQuotas maxArrayLength="1048576" />
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
<binding name="SecureBasicHttpBinding" maxReceivedMessageSize="1048576">
<readerQuotas maxArrayLength="1048576" />
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="AjaxBehavior">
<webHttp DefaultOutgoingResponseFormat="json" />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="DvaMfs.WcfService">
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add scheme="https" port="443" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
服务看起来像这样
<service name="DvaMfs.WcfService.ProductService" behaviorConfiguration="DvaMfs.WcfService">
<endpoint name="ProductServiceEndPoint" address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding" contract="DvaMfs.WcfService.IProductService" />
<endpoint name="ProductServiceAjaxEndPoint" address="ajax" binding="webHttpBinding" bindingConfiguration="WebHttpBinding" behaviorConfiguration="AjaxBehavior" contract="DvaMfs.WcfService.IProductService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint name="ProductServiceSecureEndPoint" address="ProductServiceSecure" binding="basicHttpBinding" bindingConfiguration="SecureBasicHttpBinding" contract="DvaMfs.WcfService.IProductService" />
<endpoint name="ProductServiceAjaxSecureEndPoint" address="ProductServiceSecureajax" binding="webHttpBinding" bindingConfiguration="SecureWebHttpBinding" behaviorConfiguration="AjaxBehavior" contract="DvaMfs.WcfService.IProductService" />
</service>
更新 2这是失败的端点之一:
<endpoint name="DataServiceSecureEndPoint" address="" binding="basicHttpBinding"
bindingConfiguration="SecureBasicHttpBinding" contract="DvaMfs.WcfService.IDataService" />
最佳答案
WCF 可以有不同的 HTTP 或 HTTPs 端点。我认为这是问题所在,所以我将其作为“答案”(希望对您有所帮助):
您的端点名称="ProductServiceEndPoint"address="" 它暴露在您的基地址。好的
您的端点名称="ProductServiceSecureEndPoint"address="ProductServiceSecure"bindingConfiguration="SecureBasicHttpBinding"它暴露在基础“base_address]/ProductServiceSecure”。
所以这个端点:
不正确,因为地址可能是“ProductServiceSecure”
关于c# - HTTP 415 无法处理消息,因为内容类型 'application/json; charset=utf-8' 不是预期的类型 'text/xml; charset=utf-8',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26625191/
所以,据我所知,这个类并不存在于标准 Java 库中,而是 Dalvik 中的新增内容。这是正确的吗? 我认为这是 android 类“NdefRecord”包含对它的引用并使用它的原因,但无法将其导
我想创建一些处理编码的示例程序,特别是我想使用宽字符串,例如: wstring a=L"grüßen"; wstring b=L"שלום עולם!"; wstring c=L"中文"; 因为这些是
有人知道一种更快的方法来完成 java.nio.charset.Charset.decode(..)/encode(..) 的功能吗? 这是我目前使用的技术的瓶颈之一。 [编辑]具体来说,在我的应用程
我想创建一些处理编码的示例程序,特别是我想使用宽字符串,例如: wstring a=L"grüßen"; wstring b=L"שלום עולם!"; wstring c=L"中文"; 因为这些是
我正在检查代码并遇到以下行。 Charset.forName("ASCII") 但是当我查看 java documentation它只有 US-ASCII ISO-8859-1 UTF-8
初始化 PDO 时 - 我应该做:charset=UTF8 还是 charset=UTF8MB4? 这是我的初始化: $dsn = 'mysql:host=example.com;dbname=tes
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 9 年前。 Improve
据我所知,在 String.getBytes(charset) 中,参数 charset 表示该方法返回编码为给定字符集的字符串字节。 在 new String(bytes, charset) 中,第
我正在使用 sqlsrv 驱动程序连接到带有 PDO 的 MS SQL 服务器。 PHP 版本为 5.3.24。工作连接如下所示: $dsny = "sqlsrv:Server=xx1;Databas
我的算法有两个输入: 1 个将被编码的 utf8 String 对象 1 个字符集对象,指示我需要将字符串编码成什么 最后,返回的结果将被放入一个OutputStream,一个可能发生多次但至少一次的
获取多个字符集:text/json; Charset=UTF-8;charset=utf-8 OkHttp Header 调用 okHttp Library 服务器时。有人知道我该如何解决这个问题。
使用 firebug 时,我在我的 asp.net mvc 4 项目中收到此连线错误“NetworkError: 415 Cannot process the ...xt/xml; charset=u
当我尝试通过 ant 运行我的 TestNG 测试时,我得到了 java.lang.NoSuchMethodError: org.springframework.http.MediaType.getC
我正在使用 .NET 4.0 在 IIS 7.5 中托管 WCF 服务。我还有一个 WPF 应用程序,用作我的客户端,它是使用 Visual Studio 2010 和 .NET 4.0 构建的。我添
我一直在尝试向 soap 服务器发送正确的请求。我不断收到错误消息。 这是我的xml GET LAST REQUEST(添加换行符): 1 获取最后的回复: 请求 header : POST /
我在通过 ajax json 调用 WCF 服务时收到上述响应。我的调用代码是: $(document).ready(function () { $.ajax
我尝试使用独立应用程序使用 WCF Web 服务。我可以使用 Internet Explorer 查看此服务,也可以在 Visual Studio 服务引用中查看。 这是我遇到的错误 The cont
我使用独立应用程序创建了 WCF 服务并测试了 WCF 客户端。我能够使用 Internet Explorer 查看此服务,也能够在 Visual Studio 服务引用中查看。这是错误消息。 “响应
我们有一个在 HTTPS 上运行良好但在 HTTPS 上显示 HTTP 415 错误的网络服务。因此,在 HTTP 下,我们可以毫无问题地发送和接收 JSON 的 POST 请求。当我们在 HTTPS
我正在将 spring-boot 从 1.3.6 更新到 2.1.3,而之前响应的内容类型为 application/json;charset=UTF-8 ,现在我得到了一个 iso-8859-1 的
我是一名优秀的程序员,十分优秀!