SlideServe
Menu
Préférences
© SlideServe · v2026

WCF デモ

taji avatar
12 diapositives · 459 Views · Aug 04, 2014

WCF デモ. WCF を使ったネットワークアプリ作成. デモ内容. ゲームプロトタイプ キャラの位置を動かすだけのシンプルなもの 位置をサーバ側で管理 複数のクライアントで位置を同期. WCF とは. .NET Framework 3.0 で 追加されたウェブサービス基盤 Windows Communication Foundation http://msdn.microsoft.com/ja-jp/library/ms735119.aspx http://www.atmarkit.co.jp/fdotnet/wcf/index/index.html.

WCF デモ - slide 1
01 / 12WCF デモ
1 / 17

Télécharger la présentation

WCF デモ
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. WCFデモ WCFを使ったネットワークアプリ作成

  2. デモ内容 • ゲームプロトタイプ • キャラの位置を動かすだけのシンプルなもの • 位置をサーバ側で管理 • 複数のクライアントで位置を同期

  3. WCFとは • .NET Framework 3.0で追加されたウェブサービス基盤 • Windows Communication Foundation • http://msdn.microsoft.com/ja-jp/library/ms735119.aspx • http://www.atmarkit.co.jp/fdotnet/wcf/index/index.html

  4. ウェブサービスの構成要素 • エンドポイント: ABC • Address: どこで(Where) • http://ufcpp.net/Services, net.tcp://localhost/Services, etc. • Biding: どうやって(How) • HTTP/SOAP, TCP,named pipe, .NET Remoting, etc. • Contract: 何を(What) • 商取引、ゲーム、チャット、IM、SNS、etc.

  5. エンドポイント • 1つのサーバ/クライアントが複数のエンドポイントを持てます クライアント サーバ 例1: 複数のContract A: http://ufcpp.net/game B: Basic HTTP C: ゲームサーバ A A A A B B B B C C C C A: http://ufcpp.net/chat B: Basic HTTP C: チャットサーバ

  6. エンドポイント • 1つのサーバ/クライアントが複数のエンドポイントを持てます クライアント サーバ 例2: 複数のBinding A: http://ufcpp.net/game B: Basic HTTP C: ゲームサーバ A A A A B B B B C C C C A: net.pipe://localhost/game B: 名前付きパイプ C: ゲームサーバ

  7. WCFContract • WCFでは、Contract(何をするか)に注力できます • 普通の.NETクラスライブラリに属性をつけるだけ [ServiceContract] interfaceIGameCharacter { void Move(Vector movement); } [ServiceContract] interfaceIGameCharacterCallback { void SetLocation(Point location); }

  8. クラスライブラリとして利用 • Contractクラスは、単なるクラスライブラリとしても使えます デモ • ユーザからの入力に応じて丸が動く • WPFを利用

  9. WCFにおけるABC • App.config/Web.configに設定を記述 <configuration> <system.serviceModel> <client> <endpoint name="GameCharacterIis" address="http://localhost/Services/Game.svc" binding="wsDualHttpBinding" contract="WcfGameSample.IGameCharacter"> </endpoint> </client> </system.serviceModel> </configuration>

  10. デバッグ用ホストサーバ • WCFライブラリ • WCFサービスホストというデバッグ用のプログラムでホストしてくれる デモ

  11. サービスをIISでホスト • .svcファイルを記述 • ASP.NETの.aspxと同じ要領 <%@ServiceHost Language="C#" Debug="true" Service="WcfGameSample.GameCharacter"%> デモ

  12. セルフホストサーバ • ServiceHost,ChannelDispatcherクラスなどを使って自前でホスティング可能 Uri address = newUri("net.pipe://localhost/game"); NetNamedPipeBinding binding = newNetNamedPipeBinding(); Type contract = typeof(IGameCharacter); using (ServiceHostserviceHost = newServiceHost(typeof(GameCharacter))) { serviceHost.AddServiceEndpoint(contract, binding, address); Console.WriteLine("ENTERキーでサービス終了"); Console.ReadLine(); serviceHost.Close(); } デモ