2012-05-31 81 views
1

基本WCF服務項目包括protobuf-net .dll庫。WCF protobuf-net未顯示幫助頁面

打開網頁瀏覽器並轉到localhost/wcf/service1.svc,一切正常。

現在轉到localhost/wcf/service1.svc/help,在瀏覽器控制檯(如firebug)上顯示400錯誤請求。

這裏的的web.config

<bindings> 
    <basicHttpBinding> 
    <binding name="BasicHttpBinding1" messageEncoding="Mtom"> 
     <security mode="None"></security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 

<behaviors> 
    <serviceBehaviors> 
    <behavior name="Service1Behavior"> 
     <serviceMetadata httpGetEnabled="true"/> 
     <serviceDebug includeExceptionDetailInFaults="true"/> 
    </behavior> 
    </serviceBehaviors> 

    <endpointBehaviors> 
    <behavior name="protoEndpointBehavior"> 
     <protobuf /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

<extensions> 
    <behaviorExtensions> 
    <add name="protobuf" type="ProtoBuf.ServiceModel.ProtoBehaviorExtension, protobuf-net"/> 
    </behaviorExtensions> 
</extensions> 

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" /> 

<services> 
    <service name="WcfService1.Service1" behaviorConfiguration="Service1Behavior"> 
    <endpoint address="" contract="WcfService1.IService1" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding1" behaviorConfiguration="protoEndpointBehavior" /> 
    </service> 
</services> 

+0

第一個問題:在添加任何protobuf-net之前做過該網址工作 –

+0

第二個問題:是否有任何事情記錄爲任何錯誤? –

+0

第三個問題:您是否嘗試過擴展名的長形式?即對於v2r480,請嘗試「ProtoBuf.ServiceModel.ProtoBehaviorExtension,protobuf-net,Version = 2.0.0.480,Culture = neutral,PublicKeyToken = 257b51d87d2e4d67」' –

回答

1

只是需要它來顯示幫助頁面:

<bindings> 
    <webHttpBinding> 
    <binding name="WebHttpBinding1" > 
     <security mode="None"></security> 
    </binding> 
    </webHttpBinding> 
<bindings> 

<behaviors> 
    <endpointBehaviors> 
    <behavior name="protoEndpointBehavior"> 
     <webHttp helpEnabled="true"/> 
     <protobuf /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 

<services> 
    <service name="WcfService1.Service1" behaviorConfiguration="Service1Behavior"> 
    <endpoint address="" contract="WcfService1.IService1" binding="webHttpBinding" bindingConfiguration="WebHttpBinding1" behaviorConfiguration="protoEndpointBehavior" /> 
    </service> 
</services> 

也爲馬克說,basicHttpBinding的允許消息編碼MTOM,這提高效率。但webHttpBinding不允許它。

+1

沒有必要添加**解決**標籤,而是接受答案。 –