WCF 和证书的糟糕性能(相互身份验证) [英] Terrible Performance with WCF and certificates (mutual authentication)

查看:38
本文介绍了WCF 和证书的糟糕性能(相互身份验证)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Guys / Gals we are having terrible performance with our website that uses WCF as the application later. We are using message level security and certificates (mutual authentication). We are caching the channel factory in the application object:

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)

        Dim loChannelFactor As New ChannelFactory(Of OurReference.IWCFChannel)("ClientEndpoint")
        loChannelFactor.Open()
        Application.Add("ChannelFactory", loChannelFactor)
End Sub

In every page that we need data we do the following:

Dim Proxy = DirectCast(voWebApp("ChannelFactory"), ChannelFactory(Of OurInfoReference.IOurInfoChannel)).CreateChannel

Proxy.DataCall()

If roWCFService IsNot Nothing Then
        CType(roWCFService, ICommunicationObject).Close()
        roWCFService = Nothing
End If

Also i have set establishsecuritycontext = true.

We are not wanting to cache the proxy because of having to mess with a faulted proxy state. As far as i know caching the channel stack should be enough anyways. When i turn on tracking i'm seeing a bunch of SCT commands instead of just for the first call like i would expect. Does anyone know whats going on. Are we caching the channel factory incorrectly?

thanks, Ncage

解决方案

Looks like you could solve it using a certificate from a ceritificate authority:

"MakeCert is a tool provided by Microsoft to create test certificates that can be used during the development of a product (For developing and testing purposes only). These certificates have also performance problems, certain cryptographic operations may perform slowly when they are used. Certificates issued from a true Certificate Authority do not have this problem, and it is a know issue."

http://weblogs.asp.net/cibrax/archive/2006/08/08/Creating-X509-Certificates-for-WSE-or-WCF.aspx

Edit: May be the extra activity is due to initial handshake when creating of a session. WCF default is per call, that is a new session is created for each call. You could try marking your contract with:

[ServiceContract(Session = true)]

That may maintain the session and avoid the initial handshake.

这篇关于WCF 和证书的糟糕性能(相互身份验证)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆