1

このような質問を重ねて本当に申し訳ありません。同様の投稿がありましたが、解決策はどれもうまくいきませんでした。

VisualStudio2010 で新しい WCF サービス プロジェクトを作成しました。IService1.cs、Service1.svc、および Service1.svc.cs を作成します。

そのため、サービスをデバッグ/開始しようとすると、次のエラーが発生します。私はWin7 x64を実行しています。そして、統合されたVisualStudio開発サーバーを使用しています(プロジェクトを右クリック->「Web」ページに移動します)。

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

IISで実行せずにそれを修正する方法はありますか?

前もって感謝します。

Service1.svc には次の 1 行のみが含まれます。

<%@ ServiceHost Language="C#" Debug="true" Service="Projector.Service1" CodeBehind="Service1.svc.cs" %>

Service1.svc.cs には、自動生成されたクラスが含まれています。

namespace Projector
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1

これがWeb.configです

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <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="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>
4

3 に答える 3

0

これを解決しました

これは、IIS 8 での WCF サービスの公開に関するすべてです。

すべてのクレジットは György Balássy に帰属します

Web サーバーは .svc ファイルを対象とする受信要求を処理する方法を知らないため、WCF サービスは IIS 8 で既定の構成では実行されません。次の 2 つの手順で教えることができます。

ここで同じ回答を確認してください。

https://stackoverflow.com/a/45979587/3059688

于 2017-08-31T10:50:45.860 に答える