カスタム BehaviorExtension を使用する REST サービスを自己ホストしています。動作拡張を ServiceBehaviors に追加すると、次のエラーが発生します。
「構成の要素が無効です。拡張機能名 'unityServiceBehavior' は、system.serviceModel/extensions/behaviorExtensions のコレクションに登録されていません。」
私の App.Config は以下のとおりです。
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service behaviorConfiguration="MyServiceTypeBehaviors" name="My.Core.Services.PartyService">
<endpoint behaviorConfiguration="RESTBehavior" binding="webHttpBinding" name="PartyService" contract="My.Core.Services.IPartyService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/parties" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
<!--Adding this behavior causes the error />-->
<UnityServiceBehavior />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="RESTBehavior">
<webHttp helpEnabled="true" />
</behavior>
</endpointBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="UnityServiceBehavior" type="My.Core.Services.UnityServiceBehavior, My.Core.Services, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</behaviorExtensions>
</extensions>
</system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> </configuration>
これに関するアイデアはありますか?
編集:動作拡張をロードするには、構成に登録する必要があることをどこかで読みました。
拡張機能を構成に登録するために何か特別なことをする必要がありますか?
ありがとう。