2011-03-31 77 views
2
<system.serviceModel> 
    <extensions> 
     <behaviorExtensions> 
      <add name="WSDLFlatteningExtension" type="Thinktecture.ServiceModel.Extensions.Description,Thinktecture.ServiceModel.Extensions.Description,Version=1.0.0.0,Culture=Neutral,PublicKeyToken=f0de9a190a6d23d1"/> 
     </behaviorExtensions> 
    </extensions> 
    <behaviors> 
    <endpointBehaviors> 
     <behavior name="WSDLFlatteningBehavior"> 
      <WSDLFlatteningExtension /> 
     </behavior> 
    </endpointBehaviors>  
    </behaviors> 
</system.serviceModel> 

<WSDLFlatteningExtension />上面的行無法在我的web.config中識別。在運行時引發錯誤。我已經將C:\ windows \ Assembly中的dll和C:\ Program Files \ Microsoft Visual Studio 9.0 \ Common7 \ IDE中的dll刪除了,但似乎沒有任何工作。無法將WCF行爲擴展添加到端點行爲

+2

它會拋出什麼確切的錯誤? – archil 2011-03-31 20:01:32

回答

1

我能解決這個問題。這是我所引用的dll的問題。我必須在該類中實現BehaviorExtensionElement才能使其在配置中可用。

+3

請顯示代碼 – PositiveGuy 2013-12-15 07:03:49

+2

我有同樣的問題。我無法解決它。我無法理解你的答案。你能否詳細說明一下? – Sundeep 2014-07-24 16:47:10

1

假設錯誤是AssemblyNotFoundException,那麼你也可以嘗試在你的配置文件中添加一個DependentAssembly引用,這樣框架可以解析類型中指定的AssemblyName。

0

我建議你檢查你的type=屬性中指定的類型名稱 - 它看起來不正確。您需要指定要添加的IEndpointBehavior類型的完全限定名稱。

0

是的,type =屬性對我來說也是錯誤的。它應該像type =「Your.Full.Namespace.ClassName,Your.Assembly.Name,Version,Culture,PublicKeyToken」。

Example from MSDN

type="Microsoft.WCF.Documentation.EndpointBehaviorMessageInspector, HostApplication, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"