2012-05-08 5 views
1

IISに配備された単純なWCFサービスを使用しています。私はsimplified configurationBasicHttpBindingを使用しましたが、これはうまくいきました。簡体構成wsHttpBinding

ユーザー名/パスワード認証を追加し、wsHttpBindingを使用しました。上記のドキュメントでは、

であり、要素はオプションです。 サービスでエンドポイントが定義されていない場合は、各基本アドレスのエンドポイントと 契約が実装されています。エンドポイントを決定するために基本アドレスは契約名に付加された であり、バインディングはアドレススキームによって決定される。

これはどういう意味ですか、wsHttpBindingバインディングアドレススキームを設定する必要がありますか?

私の設定は次のようになります。

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <bindings> 
     <wsHttpBinding> 
     <binding> 
      <security mode="Message"> 
      <transport clientCredentialType="None"/> 
      <message clientCredentialType="UserName"/> 
      </security> 
     </binding> 
     </wsHttpBinding>  
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="SampleWebservice.CustomValidator,SampleWebservice" /> 
      </serviceCredentials> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

これは、Windows Server 2008で、それはそう7

をIIS私はいつもBasicHttpBindingを見ることができるように、サービスは、のWSBinding設定を拾っていませんダウンロードしたsvcファイルに保存します。何か不足していますか?

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <system.web> 
    <compilation debug="true" targetFramework="4.0" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
     <service name="SampleWebservice.SampleWebservice.Sample" behaviorConfiguration="customServiceBehaviour"> 
     <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" /> 
     <endpoint contract="SampleWebservice.SampleWebservice.ISample" binding="wsHttpBinding" bindingConfiguration="bindingConfiguration" address="" /> 
     </service> 
    </services> 
    <bindings> 
     <wsHttpBinding> 
     <binding name="bindingConfiguration"> 
      <security mode="Message"> 
      <transport clientCredentialType="None"/> 
      <message clientCredentialType="UserName"/> 
      </security> 
     </binding> 
     </wsHttpBinding>  
    </bindings> 
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="customServiceBehaviour"> 
      <serviceCredentials> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="SampleWebservice.CustomValidator,SampleWebservice" /> 
      </serviceCredentials> 
      <serviceMetadata httpGetEnabled="true" /> 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 
</configuration> 

しかし、メタデータを公開することはできません。


EDITは、私は私のweb.configファイルを変更するユーザーstevedociousによって提案された変更を適用します。ブラウザでサービスを確認すると、現在自分のメタデータの公開が無効になっています。

答えて

2

http/httpsアドレス体系でbasicHttpBinding以外のものを使用する場合は、エンドポイントを作成する必要があります。あなたのバインディング定義では

は、あなたのエンドポイントの定義にbindingConfigurationと結合パラメータを追加> ...名= "myWSBindingを" 結合name属性

<を追加

<エンドポイントバインディング= "wsHttpBinding" bindingCongifuration = "myWSBinding" ...>

+0

私はあなたのアプローチに従いましたが、このサービスのメタデータ公開は現在無効になっています。私はブラウザで私のSVCファイルをチェックします。適用される変更については上記を参照してください。 – rdoubleui

+0

サービス名は、エンドポイント契約と同じ名前です。サービスの名前は、クラスの具体的な実装でなければなりません。インターフェイスでServiceContractを定義した場合、エンドポイントコントラクト名はインターフェイスの名前にする必要があります。 – tophatsteve

+0

ありがとう、問題を解決しました。エンドポイントにServiceContractを指定しなければなりませんでした。これはインターフェイス 'ISample'です。 – rdoubleui

関連する問題