0

サービスにアクセスするためにユーザー名とパスワードを持つ Web サービスをセットアップしようとしています。このリンクをガイドとして使用していますhttp://www.codeproject.com/Articles/642997/Generate-username-authentication-based-on-basicHtt

以下のエラーを回避できない領域に到達しました。以下の私の設定では、このエラーメッセージを受け取りました

ホスト ('Anonymous') で構成された認証スキームは、バインディング 'BasicHttpBinding' ('Basic') で構成されたものを許可しません。SecurityMode が Transport または TransportCredentialOnly に設定されていることを確認してください。さらに、この問題は、IIS 管理ツール、ServiceHost.Authentication.AuthenticationSchemes プロパティ、アプリケーション構成ファイル内のエレメント、バインディングの ClientCredentialType プロパティの更新、または調整によって、このアプリケーションの認証スキームを変更することによって解決される場合があります。 HttpTransportBindingElement の AuthenticationScheme プロパティ。

私の設定ファイルは

<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="customBehavior">
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceCredentials>
        <userNameAuthentication
          userNamePasswordValidationMode="Custom"
          customUserNamePasswordValidatorType="Project.Services.MyService, Project.Services"/>
      </serviceCredentials>
    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <basicHttpBinding>
    <binding name="MyBasicHttpBinding">
      <security mode="Transport">
        <transport clientCredentialType="Basic" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>
<services>
  <service behaviorConfiguration="customBehavior" name="Project.Services.MyService">
    <endpoint address=""
      binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBinding"
      contract="Project.Services.Interfaces.ITechnology">
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost/Service/myService.svc" />
      </baseAddresses>
    </host>
  </service>
</services>
  </system.serviceModel>
  <appSettings>
    <add key="userName" value="user1"/>
    <add key="password" value="password"/>
  </appSettings>
</configuration>

wcf サービスは、Windows Phone 8 アプリケーションで使用されます。エラーに関するいくつかの記事を読み、エンドポイント アドレスを "" に設定しましたが、何も機能していません。あまりにも多くの変更を加えていたため、間違った方向に進んでしまった可能性があるため、上記の構成に戻らなければなりませんでした。

このサービスは、私のローカル IIS (Win 8 64 ビット プロ + すべての更新プログラム) でホストされています。

誰でも助けてもらえますか?

4

1 に答える 1

1

エラーによると、サービスで「基本認証」を許可するように IIS を設定する必要があります。

IIS 管理コンソールで、認証タブを選択し、「基本認証」を許可するように設定します。また、「匿名認証」を無効にしてください。

「基本認証」がない場合は、この役割を IIS に追加する必要があります。ここで方法を確認してください

于 2013-10-31T22:09:09.073 に答える