machine.config
で宣言されているsectionHandlers
に依存するカスタムセクション(web.config
)を使用して、多くのWebアプリケーションが構成されています。AssemblyBinding BindingRedirectは、serviceModelで構成された動作では機能しません。 (Wcf)
我々はこれらのsectionHandlers
の複数のバージョンを持っているとして、新しいsectionHandlers
を使用するアプリケーションは、そのweb.config
にタグ<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
を使用して、「アセンブリのリダイレクトを」強制する必要があります。最も古いバージョンを使用する他のアプリケーションがまだ存在する限り、machine.config
のsectionHandlers
の宣言を実際に変更することはできません。
バインドリダイレクトは、web.configのsystem.serviceModel
セクションでWCFビヘイビアを定義するために使用される型を含むアセンブリを除いて、前述のタグを使用してアプリケーションによってロードされたすべてのアセンブリに対して正常に機能します。
たとえば、いくつかのアプリケーションでは、カスタム動作の拡張子mainframeFormatter
が使用されています(この後の例のweb.configを参照)。バージョン1.2.0.0へのタイプmainframeFormatter
を格納しているアセンブリのバージョン1.1.0.0からbindingRedirect
を追加する場合、我々は次のエラーを取得する:我々は唯一の「行動」に問題がある
An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element'mainframeFormatter' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.
お知らせと「バインディング」ではなく これはWCFビヘイビアを使用したバインドリダイレクトの予想される動作ですか、これはバグですか?ここで
は、バインディングリダイレクトを使用するときに解析されないweb.config
のサンプルです:
<system.serviceModel>
<extensions>
<behaviorExtensions>
<add name="mainframeFormatter"
type="Framework.Communication.Mainframe.ClientEndpointBehaviorExtensionElement,
Framework.Communication.Mainframe, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=f510307097254a31"/>
</behaviorExtensions>
<bindingExtensions>
<add name="mainframeBinding"
type="Framework.Communication.Mainframe.BindingCollectionElement,
Framework.Communication.Mainframe, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=f510307097254a31"/>
</bindingExtensions>
</extensions>
<behaviors>
<endpointBehaviors>
<behavior name="ClientEndpointBehavior">
<mainframeFormatter /> <--- Problem is on parsing this with assemblyBinding enabled
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<mainframeBinding>
<binding name="MyCustomBinding"/>
</mainframeBinding>
</bindings>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Framework.Communication.Mainframe"
publicKeyToken="f510307097254a31" />
<bindingRedirect oldVersion="1.1.0.0" newVersion="1.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
私はbehaviorExtension
設定でバージョンを変更して問題を解決することを知っています。しかし、なぜリダイレクトが機能しないのか不思議です。