2011-11-25 4 views
0

machine.configで宣言されているsectionHandlersに依存するカスタムセクション(web.config)を使用して、多くのWebアプリケーションが構成されています。AssemblyBinding BindingRedirectは、serviceModelで構成された動作では機能しません。 (Wcf)

我々はこれらのsectionHandlersの複数のバージョンを持っているとして、新しいsectionHandlersを使用するアプリケーションは、そのweb.configにタグ<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">を使用して、「アセンブリのリダイレクトを」強制する必要があります。最も古いバージョンを使用する他のアプリケーションがまだ存在する限り、machine.configsectionHandlersの宣言を実際に変更することはできません。

バインドリダイレクトは、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設定でバージョンを変更して問題を解決することを知っています。しかし、なぜリダイレクトが機能しないのか不思議です。

答えて

1

すぐに修正プログラムを提供します。