0

エラーは次のとおりです。

タイプ'WF.XXX.WebServices.XXXXService'、ServiceHostディレクティブでService属性値として提供されているか、構成要素system.serviceModel / serviceHostingEnvironment/serviceActivationsで提供されているものが見つかりませんでした。

スタックトレース:

[InvalidOperationException:タイプ'WF.XXX.WebServices.XXXXService'、ServiceHostディレクティブでService属性値として提供されているか、構成要素system.serviceModel / serviceHostingEnvironment/serviceActivationsで提供されています。]
System.ServiceModel.Activation .ServiceHostFactory.CreateServiceHost(文字列constructorString、Uri [] baseAddresses)+52742
System.ServiceModel.HostingManager.CreateService(String NormalizedVirtualPath)+1459 System.ServiceModel.HostingManager.ActivateService(String NormalizedVirtualPath
)+44
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)+623

[ServiceActivationException:コンパイル中の例外のため、サービス'/XXXXX/XXXXXService/XXXXService.svc'をアクティブ化できません。例外メッセージは次のとおりです。タイプ'WF.XXX.WebServices.XXXXService'、ServiceHostディレクティブでService属性値として提供されているか、構成要素system.serviceModel / serviceHostingEnvironment/serviceActivationsで提供されています。]システム。 Runtime.AsyncResult.End(IAsyncResult result)+687598 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)+190
System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar)+304662
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)+94

サーバーでこのエラーを修正するにはどうすればよいですか?

2012年9月18日の更新:VisualStudio2012と.NETFramework4.5 がマシンにインストールされていますが、サーバーには.NETFramework4.0しかありません。.NET Framework 4.0を使用してサービスを構築したため、これが重要かどうかはわかりません。

しかし不思議なことに、プロジェクトを実行したときに4.5の機能に気づきました。.NET4.0バージョンでは使用できないsingleWSDLファイルへのURLが表示されます。プロジェクトが.NETFramework4.0でビルドされているときに、これが表示されるのはなぜですか?スクリーンショットは次のとおりです。 ここに画像の説明を入力してください

2012年9月19日更新:

関連するweb.configファイルは次のとおりです。

<system.serviceModel>
    <services>
      <service name="XXXXService">
        <!-- Use a bindingNamespace to eliminate tempuri.org -->
        <endpoint address=""  name="XXXXService"
                  binding ="basicHttpBinding" 
                  bindingNamespace="@services.url@/XXXXService" 
                  contract="WF.XXX.WebServices.XXXXService" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceCredentials>
            <clientCertificate>
              <authentication certificateValidationMode="None" mapClientCertificateToWindowsAccount="true" />
            </clientCertificate>
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
4

3 に答える 3

1

あなたの質問に答えるために

(1)プロジェクトがビルドされ、サービスタイプXXXXServiceを含むdllがbinディレクトリに配置されていることを確認します。

(2)単一のWsdlは4.5の新機能です。4.5は4.0のインプレースアップグレードであるため、プロジェクトを4.0にターゲット設定した場合でも、?SingleWsdlのメリットが得られます。ただし、4.0だけのマシンに同じサービスを展開すると、これを取得できなくなります。これをサービスマシンで取得するには、4.5もインストールされていることを確認してください。

お役に立てれば。

ありがとう!

于 2012-09-24T18:42:36.960 に答える
1

同じ問題が発生しました。原因は、コードファイルの名前空間を変更IService1.csService1.svc.csたのに、ファイルの名前空間を変更するのを忘れたためService1.svcです。

EG inservice1.svc

< % @ ServiceHost Service="WcfService2.Service1" % >

次のように変更する必要があります:

< % @ Service="NewNamespaceName.Service1" % >

Visual Studioがタイプミスをキャッチすることなく、ソリューションを構築できます。

于 2013-08-21T14:49:10.743 に答える
0

私も同じ問題を抱えていました。私の場合、binフォルダーとobjフォルダーを削除して再構築するだけで、問題が修正されました。

于 2015-12-02T22:45:53.933 に答える