2012-01-25 6 views
3

wsHttpとJSONエンドポイントを使用してWebサービスを作成しています。以下の設定はウェブサイトプロジェクトでホストされ、ウェブサイト内でサービス参照を作成しようとする場合を除いて正常に動作します。エンドポイントの動作によってエラーが発生するようです。WebHttpとwsHttpを含むVS2010のサービス参照を追加する際のエラー

"Extension Error 'webHttp' cannot be added to this element. Verify the exception is registered in the extension collection at system.servicemode/extensions/behaviorExtensions"

svcUtil.exeでエラーは発生しません。それはVS特有のようですが、私はそれの底を取得したいと思います。

<system.serviceModel> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="JSON"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
      <behavior name="HelloWorldBehavior"> 
       <serviceMetadata httpGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="false" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <services> 
     <service behaviorConfiguration="HelloWorldBehavior" name="HelloWorld"> 
      <endpoint address="/json" behaviorConfiguration="JSON" 
      binding="webHttpBinding" contract="IHelloWorld" > 
      </endpoint> 
      <endpoint name="wcf" address="" binding="wsHttpBinding" 
      contract="IHelloWorld" /> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 
    </services> 
</system.serviceModel> 
+0

IEを使用してサービスを参照しようとしましたか?もしそうなら、何かエラーがありましたか? – Rajesh

+0

はい、問題なく動作します。 – Chris

+0

使用しているフレームワークは何ですか?また、プロジェクトはVS2008からVS2010に移行されました。その場合は、サービス参照を削除してもう一度追加してください。 – Rajesh

答えて

5

私はそれがあなたの問題を解決するかどうかわかりませんが、私はここで同様の問題について私の経験を共有するべきだと思います。

私はほとんど同様のエラーを取得しました。

Extension element 'webHttp' cannot be added to this element. Verify that the extension is registered in the extension collection at system.servicemodel/extensions/behaviorExtensions.

error message

私はこの事を解決するために多くのことを試みたが、それを行うことができませんでした。その後、私はthisページから、同様の問題にこの提案を見つけました:

check your client (ASP.NET MVC) config and comment the WCF endpoint behavior which uses <enableWebScript /> . Then add your service reference and uncomment the behavior. Same procedure has to be done if you want to update existing script reference. I guess it is a bug and should be reported to Microsoft Connect.

鉱山は、ASP.NET MVCはありませんでしたが、私は私のアプリから、この部分

<behavior name="web"> 
      <webHttp /> 
     </behavior> 

をコメントアウトすることで提案を試してみました。設定して、サービス参照を追加することができます!次に参照を追加した後、私はその部分のコメントを解除しました。

私はそれを説明できません。それはちょうど私のために働いた、それが私が共有している理由です。ありがとう。

+1

素敵なグラフィック。私はあなたのポップアップを閉じようとし続けました。 –

関連する問題