Upload
netarchitects
View
3.958
Download
2
Embed Size (px)
DESCRIPTION
Na 12ª reunião do .NetArchitects o Rafael Godinho ministrou para o grupo uma ótima palestra sobre como distribuir aplicações com WCF.
Citation preview
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Rafael GodinhoEspecialista em Desenvolvimentohttp://blogs.msdn.com/rafaelgodinhoMicrosoft Brasil
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Camada de serviços
O que NÃO é WCF
O que é WCF
Cenários de uso
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Fonte: P&P - Application Architecture Guide 2.0
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Fonte: Martin Fowler - Patterns of Enterprise Application Architecture
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
“A camada de serviço define uma fronteira daaplicação com as operações disponíveis a partirda perspectiva dos clientes. Ela encapsula asregras de negócio, controla as transações ecoordena as respostas.”
Fonte: Martin Fowler - Patterns of Enterprise Application Architecture – Tradução livre
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
SOA – Service Oriented Architecture
Web Service
WSDL
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Plataforma unificada de comunicação
My
System
.NET
Remoting
ASMX
WSE
MSMQ
Enterprise
Services
WCFMy
Service
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Evolução do .NET Frameworkao longo dos anos
.net 1.0
.net 1.1
.net 2.0
.net 3.0.net 3.5
Microsoft .NET Framework 1.0 2002
Microsoft .NET Framework 1.1 2003
Microsoft .NET Framework 2.0 2005
Microsoft .NET Framework 3.0 2006
Microsoft .NET Framework 3.5 2007
Microsoft .NET Framework 3.5 SP1 2008
Microsoft .NET Framework 4.0 2009
SP1
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
.NET Framework 3.5 SP1
.NET Framework 3.5
.NET Framework 3.0
.NET Framework 2.0
WCF WPF WFCard
Space
REST AJAX LINQ
ADO.NET
Entity
Framework
ADO.NET
Data
Services
ASP.NET
Dynamic
Data
ASP.NET
Routing
ADO.NET CLRWeb
ServicesASP.NET
RSS
POX ATOM JSON +BCL
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
ABC A B C
A B C
Address Binding Contract
(Onde) (Como) (O quê)
Cliente Serviço
MensagemBv
Bv
Bv
Bv
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
[ServiceContract]
public interface IMyInterface
{
[OperationContract]
public void MyMethod();
}
public class MyService: IMyInterface
{
public void MyMethod()
{
...
}
}
<service>
<endpoint name=“MyService”
address=“...”
binding=“netTcpBinding”
contract=“IMyInterface” />
Address +
Binding +
Contract =
Endpoint
Definição do
contrato
Implementação do
serviço
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Aspectos de
multi-hosting
Aspectos de
multi-protocolo e
mensagens
Aspectos de
comportamentos e
serviços
Aspectos de nível
lógico e contratos
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Similar à um protocolo de rede
Aplicação
TCP
IP
Ethernet
Aplicação
TCP
IP
Ethernet
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Service
Service Endpoints
Dispatcher
Client
Proxy
Channel
Channel
TransportChannel
Channel
Channel
TransportChannel
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Criando um serviço em WCF
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Self-Hosting Cenários
Não possui controle do ambiente
Aplicações P2P
Como Windows Service
Console Application (Desenvolvimento)
WinForms/WPF
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Managed-Hosting
Cenário Possui controle do ambiente
Alta escalabilidade e disponibilidade
Como Windows 2008: IIS/WAS (Windows Process
Activation Service)
Windows 2008 R2/.NET Framework 4.0: Dublin (Futuro)
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Hospedagem de serviços
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Enterprise Web Services
Web 2.0
Aplicações na Intranet
Mensagens Enfileiradas
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
IIS
WCF Service
SOAP/WS* SOAP SOAP/WS* SOAP/WS*
Java.NET 2.0 (ASMX)
.NET 2.0 + WSE
.NET 3.0 (WCF)
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Característica Descrição
Hospedagem IIS6 -> Windows Server 2003
IIS7 -> Windows Server 2008
Protocolo Transporte HTTP, HTTPS
Protocolo Mensageria SOAP + WS-*
Autenticação Usuário + Senha (WS-Security)
Segurança Transmissão SSL -> HTTPS
WS-Security -> HTTP
Binding BasicHttpBinding, WsHttpBinding
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
POX
REST
JSON
Feeds
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Plain-Old-XML
POXService
GetCustomers()
CreateCustomer(...)
SaveCustomer(...)
DeleteCustomer(...)
GET/GetCustomers
POST/CreateCustomer
POST/SaveCustomer
POST/DeleteCustomer
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Representational State Transfer
RESTService
GetCustomers()
CreateCustomer(...)
SaveCustomer(...)
DeleteCustomer(...)
GET/Customers
POST/Customers
PUT/Customer(x)
DELETE/Customer(x)
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
JavaScript Object Notation
IIS
WCF Service
JSON
JavaScript Silverlight Flash
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
AtomPub
Manipulação de informaçõesSomente leitura
RSSAtom
Início
Fim
Clientes antigos
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Característica Descrição
Hospedagem IIS6 –> Windows Server 2003
IIS7 -> Windows Server 2008
Protocolo Transposte HTTP, HTTPS
Protocolo Mensageria XML, JSON
Autenticação Basic Authentication
Segurança SSL
Binding WebHttpBinding
WebHttpBehavior
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
REST
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
WCF - WCF
Client
Proxy
Service
Binary/TCP
WindowsToken
AD
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Característica Descrição
Hospedagem Windows NT Service -> Windows Server 2003
WAS -> Windows Server 2008
Protocolo
Transporte
TCP
Named Pipes (cliente e serviço na mesma máquina)
Protocolo
Mensageria
SOAP + Binary
Segurança Credencial Windows
Certificado X.509
Binding NetTcpBinding
NetNamedPipeBinding
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Client
Proxy
QueuedService
Client
Proxy
QueuedService
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Característica Descrição
Hospedagem Windows NT Service -> Windows Server 2003
WAS -> Windows Server 2008
Protocolo Transporte MSMQ
Protocolo Mensageria SOAP + Binary
Segurança Certificado X.509
Binding MsmqIntegrationBinding (Legado)
NetMsmqBinding (WCF – WCF)
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Camada de serviços
O que NÃO é WCF
Visão geral do WCF ABC
Hospedagem
Cenários de uso Enterprise Web Services
Web 2.0
Aplicações na Intranet
Mensagens Enfileiradas
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Windows Communication Foundation: Application Deployment Scenarios
http://msdn.microsoft.com/en-us/library/cc512374.aspx
Meu blog
http://blogs.msdn.com/rafaelgodinho
Criando serviços REST com WCF
http://msdn.microsoft.com/pt-br/library/dd941696.aspx
P&P WCF Security Guidance Project
http://www.codeplex.com/WCFSecurity/
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
Rafael GodinhoEspecialista em Desenvolvimentohttp://blogs.msdn.com/rafaelgodinhoMicrosoft Brasil
| Rafael Godinho | http://blogs.msdn.com/rafaelgodinho |
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.