2016-07-07 13 views
0

1つのweb.configで複数のサービスを使用しようとしています。私が抱えている問題は、https://localhost/APGame.WebHost/PlayService.svc/checktraining?g=3に行くと、リソースが見つかりません(404)というエラーが出ます。私は1つのサービスと複数のサービス契約を使用してこれを実行しようとしましたが、どちらもうまくいきませんでした。1つの設定で複数のWCFバインディングまたはサービスを設定する

https://localhost/APGame.WebHost/PlayService.svcにアクセスしてサービスが実行されています。私はちょうど私が間違っていることを確信しています。 WCFため

のWeb.config

<system.serviceModel> 
    <behaviors> 
     <endpointBehaviors> 
     <behavior name="json"> 
      <webHttp defaultOutgoingResponseFormat="Json" helpEnabled="true" /> 
     </behavior> 
     </endpointBehaviors> 
    </behaviors> 
    <services> 
     <service name="APGame.Services.GameManager"> 
     <endpoint address="" binding="wsHttpBinding" contract="APGame.Contracts.IGameService" /> 
     </service> 
     <service name="APGame.Services.PlayManager"> 
     <endpoint address="" behaviorConfiguration="json" binding="webHttpBinding" contract="APGame.Contracts.IPlayService" /> 
     </service> 
    </services> 
    <bindings> 
     <wsHttpBinding> 
     <binding transactionFlow="true" sendTimeout="00:20:00"> 
      <security mode="Transport"> 
      <transport clientCredentialType="Windows" /> 
      </security> 
     </binding> 
     </wsHttpBinding> 
    </bindings> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"> 
     <serviceActivations> 
     <add service="APGame.Services.GameManager" relativeAddress="GameService.svc" /> 
     <add service="APGame.Services.PlayManager" relativeAddress="PlayService.svc" /> 
     </serviceActivations> 
    </serviceHostingEnvironment> 
    </system.serviceModel> 

サービス契約

[ServiceContract] 
public interface IPlayService 
{ 
    [OperationContract] 
    [WebInvoke(Method = "GET", UriTemplate = "/checktraining?g={groupGameId}")] 
    bool? CheckTraining(int groupGameId); 
} 
+0

bindingConfiguration="webBinding"を追加<bindings>タグ

<webHttpBinding> <binding name="webBinding"> <security mode="Transport"> </security> </binding> </webHttpBinding> 

内部の私のweb.configファイルに以下を追加しますSOAPUIを使用して結果を得ることができますか? –

+0

"APGame.Contracts.IGameService"契約はありません。 – granadaCoder

+0

@ granadaCoder私はIGameServiceの契約を結んでいます。私は新しいサービスや新しいサービス契約を作成して、Ajax w/AngularJSのRESTfulサービスとして動作させようとしています –

答えて

0

私は(この1のように:404 when running .net 4 WCF service on IIS (no svc file))非常に多くの異なる解決策を試してみましたし、それらのどれも働きました。

問題はHTTPS経由でアクセスされていることに気付きました。 .svcファイル(https://localhost/APGame.WebHost/PlayService.svc)にアクセスすることはできましたが、その後はどのメソッドにもアクセスできませんでした(例:/Playservice.svc/json/2)。この問題を解決するために、私はその後、私のサービスのエンドポイント

関連する問題