我们希望通过REST公开我们的WCF服务,并通过TCP使用SSL保护它们.我们有一个上传到Azure的有效SSL和正确的映射设置,以便访问https://service.ourdomain.com.
我已经设置了两个端点绑定,用于REST服务的webHttpBinding和用于TCP的NetHttpBinding类型的customBinding.
我想我有SSL使用webHTTP但是当我尝试在NetHTTP的自定义绑定中启用httpsTransport时,我收到错误
"无法添加传输元素'httpTransport'.绑定中已存在另一个传输元素每个绑定只能有一个传输元素"
所有的配置都是在WebRole web.config中完成的.我已经看过Silverlight人员提交的其他WCF问题,他们通过SSL帮助了webHTTP,但二进制文件让我感到难过.
是否可以从同一个SSL域运行REST和TCP WCF服务,如果是这样,我很想知道?
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="SecureWebHttpBinding">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
<customBinding>
<binding name="NetHttpBinding">
<binaryMessageEncoding />
<!--<httpsTransport authenticationScheme="None" />-->
</binding>
</customBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="RestService">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="BinaryService">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="RestService" name="WebService.Rest">
<endpoint address="Achievements"
binding="webHttpBinding"
bindingConfiguration="SecureWebHttpBinding"
behaviorConfiguration="webBehavior"
contract="WebService.JSON.IAchievementJSON"/>
</service>
<service behaviorConfiguration="BinaryService" name="WebService.Binary">
<endpoint address="Achievements"
binding="customBinding" …Run Code Online (Sandbox Code Playgroud) 如何将以下wsHttpBinding转换为customBinding?我需要这样,所以我可以增加时钟偏差.这是为http.
<wsHttpBinding>
<binding name="wsHttpSecurityOptions" maxReceivedMessageSize="10485760" maxBufferPoolSize="524288">
<security mode="Message">
<message clientCredentialType="UserName" establishSecurityContext="true" negotiateServiceCredential="true"/>
<transport clientCredentialType="Certificate" proxyCredentialType="None"/>
</security>
<readerQuotas maxStringContentLength="500000"/>
</binding>
</wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)
我的尝试(如下所示)失败,并显示错误消息"无法找到与绑定CustomBinding的端点匹配方案https的基址",但我看不出如何配置UserName消息模式安全性.
<customBinding>
<binding name="wsHttpSecurityOptions">
<transactionFlow />
<security authenticationMode="UserNameForSslNegotiated">
<secureConversationBootstrap authenticationMode="UserNameForSslNegotiated">
<localServiceSettings maxClockSkew="00:10:00" />
</secureConversationBootstrap>
<localServiceSettings maxClockSkew="00:10:00" />
</security>
<textMessageEncoding>
<readerQuotas maxStringContentLength="500000"/>
</textMessageEncoding>
<httpsTransport maxReceivedMessageSize="10485760" maxBufferPoolSize="524288" />
</binding>
</customBinding>
Run Code Online (Sandbox Code Playgroud) 在WCF服务中,我将端点绑定设置为wsHttpBinding.但是,当我使用Visual Studio添加服务引用时,我的客户端app.config将绑定显示为basicHttpBinding.有人知道为什么会这样吗?
服务web.config中的My Endpoint(在IIS 7.5中托管).从baseAddresses获取地址
<endpoint address=""
binding="wsHttpBinding"
bindingConfiguration="wsHttpServiceBinding"
contract="MyProject.IMyService" />
Run Code Online (Sandbox Code Playgroud)
客户端app.config:
<client>
<endpoint address="http://example.com/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MyService"
contract="Service.MyService" name="BasicHttpBinding_MyService" />
</client>
Run Code Online (Sandbox Code Playgroud) 我有一个Web服务,我们目前正在HTTPS站点中托管它.
我的约束力是这个.
<wsHttpBinding>
<binding maxReceivedMessageSize="2000000" >
<readerQuotas maxStringContentLength="2147483647" />
<security mode="Transport">
</security>
</binding>
</wsHttpBinding>
Run Code Online (Sandbox Code Playgroud)
它似乎运作良好.但我的主要目标是确保Web服务请求和响应都是加密的.我对网络服务了解不多,但是它有什么用呢?
只需使用HTTPS并将此行放在您的配置中?
<security mode="Transport">
</security>
Run Code Online (Sandbox Code Playgroud)
或者还有更多吗?我怎么知道发送的邮件是否加密?
我们正在编写C#客户端,它应该连接到旧的旧服务器.为了在将来可扩展,我们希望利用WCF框架.
旧的遗留协议是专有协议和二进制协议.要集成到WCF,我们希望将通常的XML序列化器替换为我们专有的二进制格式marshaller.请注意,我们不希望将XML封装到其他传输协议中,而是将XML序列化器完全替换为无关.想想WCF与CORBA(但不是真正的CORBA)交谈,它不了解任何HTTP/SOAP/MTOM/...
有人能指出我们如何做到这一点的例子
我有一个连接到WCF服务的Silverlight应用程序。在我习惯的基本配置下,将该应用程序连接到其相应的WCF服务没有问题。
但是,最近,我的一位客户开始使用Apache反向代理。该代理是公共服务器,仅用于通过客户端与其之间的SSL(HTTPS)加密HTTP通信。该代理将所有流量从它传递到托管我的应用程序的实际Web服务器。公共代理和IIS服务器之间的流量只是纯HTTP。
因此流量如下所示: 最终用户浏览器--- HTTPS ---->公共反向代理----- HTTP ---->承载WCF服务的IIS服务器。
反向代理和IIS位于两台单独的服务器上。
我无法使Silverlight应用程序正常运行。我不确定如何配置端点?每当使用公共代理服务器的地址作为端点地址时,我都会遇到问题。
Silverlight应用程序通常具有以下配置:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IPOTemplateEditorSrv" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://public-reverse-proxy-url/POTemplateEditorSrv.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPOTemplateEditorSrv"
contract="POEditorSrvRef.IPOTemplateEditorSrv" name="BasicHttpBinding_IPOTemplateEditorSrv" />
</client>
</system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)
请注意,我正在使用,并且端点地址指向反向代理的公共HTTPS地址。
我有什么想念的吗?可能还有其他信息可配置代理吗?有什么解决方法可以使我的Silverlight客户端连接到该服务?
我在WPF gridview中有两个文本框.如果没有要显示的文本,则使用视图模型上的方法(GetNoteTwoVisibility)隐藏第二个 - 没有问题.在这种情况下,虽然我想更改第一个文本框的列跨度以使用两个列.我尝试添加'GetNoteOneColumnSpan'方法(返回一个int),但这不起作用.
<TextBox Name="Note1" Grid.Column="0" Text="{Binding NotesView.NoteOne}" Grid.ColumnSpan="{Binding NotesView.GetNoteColumnSpan}" />
<TextBox Name="Note2" Grid.Column="1" Text="{Binding NotesView.NoteTwo}" Visibility="{Binding NotesView.GetNoteTwoVisibility}" />
Run Code Online (Sandbox Code Playgroud)
有没有办法做到这一点?谢谢
我刚刚增加了ServiceContract中的方法数量.当我在Visual Studio中更新服务引用时,我收到消息:
元数据包含无法解析的引用:'net.tcp://xxxxx.com:8002/DataQueryService/mex'.
XML文档中存在错误.
读取XML数据时已超出最大名称字符集计数配额(16384).nametable是用于存储XML处理期间遇到的字符串的数据结构 - 具有非重复元素名称,属性名称和属性值的长XML文档可能会触发此配额.通过更改创建XML阅读器时使用的XmlDictionaryReaderQuotas对象上的MaxNameTableCharCount属性,可以增加此配额.
原始服务器端配置是:
<services>
<service behaviorConfiguration="XXXXX.DataQueryService.ServiceBehavior" name="XXXXX.DataQueryService.QueryService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://xxxxx.com:8002/DataQueryService" />
</baseAddresses>
</host>
<endpoint name="MexEndpoint" address="mex" binding="customBinding" bindingConfiguration="unsecureTcpMex" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<customBinding>
<binding name="unsecureTcpMex">
<tcpTransport portSharingEnabled="True" />
</binding>
</customBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
我修改为:
<bindings>
<customBinding>
<binding name="unsecureTcpMex">
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding>
<tcpTransport portSharingEnabled="True" maxReceivedMessageSize="2147483647" />
</binding>
</customBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
我需要对配置进行哪些其他更改才能使其正常工作?
更新 以下@Chris的建议我尝试更新SVCUtil的配置文件.我为我的端点添加了一个名称,以便它匹配(上面更新).SvcUtil.config现在如下:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="unsecureTcpMex">
<textMessageEncoding>
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
</textMessageEncoding> …Run Code Online (Sandbox Code Playgroud) 我正在尝试在VS 2013中设置我的第一个WCF服务.我正忙着通过一个教程,但是遇到了麻烦......
运行一个简单的服务(DataViewerService),它调用数据库以返回记录集.我已将绑定更改为:
<bindings>
<basicHttpBinding>
<binding allowCookies="true"
maxReceivedMessageSize="20000000"
maxBufferSize="20000000"
maxBufferPoolSize="20000000">
<readerQuotas maxDepth="32"
maxArrayLength="200000000"
maxStringContentLength="200000000"/>
</binding>
</basicHttpBinding>
</bindings>
Run Code Online (Sandbox Code Playgroud)
在system.serviceModel中,我直接在下面包含了
<services>
<service name="DataViewerService.Service1">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/Design_Time_Addresses/DataViewerService/Service1/" />
</baseAddresses>
</host>
<endpoint address="http://localhost:2112/Viewer"
binding="basicHttpBinding"
contract="DataViewerService.IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
Run Code Online (Sandbox Code Playgroud)
谷歌搜索,我读到的只是客户端和服务器都需要设置...但是,我在localhost上运行,我在wcf测试客户端内消耗.我似乎无法弄清楚我需要在哪里做出这些改变......我错过了什么?
我想使用基本身份验证在.NET核心应用程序和完整的.NET Web服务(托管在IIS中)之间建立WCF https连接。
在.NET Core端,我有一个ChannelFactory设置如下:
var binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
factory = new ChannelFactory<T>(binding, new EndpointAddress(endpointAddress));
factory.Credentials.UserName.UserName = "abc";
factory.Credentials.UserName.Password = "xyz";
Run Code Online (Sandbox Code Playgroud)
在Web服务上,我有一个使用绑定配置的端点,如下所示:
<basicHttpBinding>
<binding name="BasicHttpBinding" maxReceivedMessageSize="10485760">
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="None" realm=""/>
</security>
</binding>
</basicHttpBinding>
Run Code Online (Sandbox Code Playgroud)
但是在运行时,我收到此错误消息:
System.ServiceModel.Security.MessageSecurityException: 'HTTP请求未经客户端身份验证方案'Basic'授权。从服务器收到的身份验证标头是“ Basic realm =“ localhost””。
我希望双方都说认证方案为“基本”,并且可以毫无问题地进行连接。我不知道领域来自何处,但我无法摆脱它。我认为这是造成问题的原因。
wcf-binding ×10
wcf ×9
.net ×2
c# ×2
.net-4.0 ×1
.net-core ×1
asp.net ×1
azure ×1
grid ×1
https ×1
security ×1
silverlight ×1
ssl ×1
wcf-security ×1
wpf ×1