2

Win 2003 サーバーで WCF サービスをホストしているときに問題が発生しています。私のローカルPCで正常に動作しているため。

Web Config を変更する必要がある場合は、今すぐお問い合わせください。ファイル。同様に。

「/」アプリケーションでサーバー エラーが発生しました。 IIS は認証スキーム 'IntegratedWindowsAuthentication, Anonymous' を指定しましたが、バインディングは正確に 1 つの認証スキームの指定のみをサポートします。有効な認証方式は、Digest、Negotiate、NTLM、Basic、または Anonymous です。1 つの認証スキームのみが使用されるように IIS 設定を変更します。説明: 現在の Web 要求の実行中に未処理の例外が発生しました。エラーの詳細とコード内のどこでエラーが発生したかについては、スタック トレースを確認してください。

例外の詳細: System.InvalidOperationException: IIS は認証スキーム 'IntegratedWindowsAuthentication, Anonymous' を指定しましたが、バインディングは正確に 1 つの認証スキームの指定のみをサポートします。有効な認証方式は、Digest、Negotiate、NTLM、Basic、または Anonymous です。1 つの認証スキームのみが使用されるように IIS 設定を変更します。

ソース エラー:

現在の Web 要求の実行中に未処理の例外が生成されました。例外の発生元と場所に関する情報は、以下の例外スタック トレースを使用して特定できます。

スタックトレース:

[InvalidOperationException: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.]
   System.ServiceModel.Web.WebServiceHost.SetBindingCredentialBasedOnHostedEnvironment(ServiceEndpoint serviceEndpoint, AuthenticationSchemes supportedSchemes) +446264
   System.ServiceModel.Web.WebServiceHost.AddAutomaticWebHttpBindingEndpoints(ServiceHost host, IDictionary`2 implementedContracts, String multipleContractsErrorMessage) +709
   System.ServiceModel.Web.WebServiceHost.OnOpening() +203
   Microsoft.ServiceModel.Web.WebServiceHost2.OnOpening() in e:\bt\3781\Microsoft.ServiceModel.Web\Microsoft.ServiceModel.Web\WebServiceHost2.cs:69
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +229
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +121
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479

[ServiceActivationException: The service '/Service.svc' cannot be activated due to an exception during compilation.  The exception message is: IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used..]
   System.ServiceModel.AsyncResult.End(IAsyncResult result) +11599786
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +278
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618 
4

1 に答える 1

3

クイックフィックスと正しいフィックスがあります。

クイックフィックス:

IIS で、サービスが実行されている Web アプリケーションのプロパティに移動し、[ディレクトリ セキュリティ] タブに移動し、[認証とアクセス制御] グループで [編集...] を押します。必要のない認証スキームを削除します。すべてのダイアログを OK してから、IIS リセットを実行します。

正しい修正:

明示的なエンドポイントを使用するようにサービスが構成されていることを確認してください。のすぐに使えるバインディングを使用し、その動作webHttpBindingを使用するようにエンドポイントを構成することwebHttpがコツであることがわかりました。

エンドポイントを指定しない場合、WebserviceHost は必要なものを推測しようとし、常に間違ったものを選択します。

web.config には、次のようなものが必要です。

<system.serviceModel>
  <services>
    <service behaviourConfiguration="MyRestService.Behavior" 
             name="MyRestService>
      <endpoint address="" binding="webHttpBinding" contract="IMyRestService"
                behaviourConfiguration="MyRestService.WebHttpEndpointBehavior" />
    </service>
  </services>
  <bindings>
  </bindings>
  <behaviours>
    <serviceBehaviors>
      <behavior name="MyRestService.Behavior">
        <!-- Any configuration for the service, i.e. serviceDebug, etc. -->
      </behavior>
    </serviceBehaviors>
    <endpointBehaviors>
      <behavior name="MyRestService.WebHttpEndpointBehavior">
        <webHttp />
      </behavior>
    </endpointBehaviors>
  </behaviours>
</system.serviceModel>

確かに、このように構成をセットアップしたことで、.NET 3.5 SP1 がインストールされた Win2k3 サーバーで WCF REST サービスを実行できるようになりました。

于 2011-03-24T10:10:03.643 に答える