同じ IIS Web アプリケーションから Net.Tcp と wsHTTP の 2 つのエンドポイントをホストしようとしていますが、うまく動作していないようです。Net.Tcp エンドポイントのみをホストすると、正常に動作します。HTTP をホストに追加するとすぐに、次のエラーが表示されます。「この引数の値は正でなければなりません。パラメータ名: maxAccepts 実際の値は 0 でした」
これがIIS 7の制限なのか、それとも私が間違っているのか、誰にも分かりますか? 私がしていることは、ServiceHostFactory クラスを拡張し、CreateServiceHost メソッドをオーバーライドすることです。コードのハイライトは次のとおりです。
Public Class QLHostFactory
Inherits ServiceHostFactory
Protected Overloads Overrides Function CreateServiceHost(ByVal svcTyp As Type, ByVal baseAddresses() As Uri) As ServiceHost
Dim QLSvcHost As ServiceHost = Nothing
Dim ntcpUri() As Uri = Nothing
' I have to filter out all other uri and leave only nettcp in the
' list to get it to work. But what I really want is to allow http in here too.
For Each u As Uri In baseAddresses
If u.Scheme = Uri.UriSchemeNetTcp Then
ReDim ntcpUri(0)
ntcpUri(0) = u
Exit For
End If
Next
QLSvcHost = New ServiceHost(svcTyp, ntcpUri)
SetHost(QLSvcHost, svcTyp) ' <== set endpoints for each baseaddresses, etc.
Return QLSvcHost
End Function