Intro to WCF From the beginning and uses Steve Maier @YsFred4 [email protected] AppRochester.
-
Upload
victor-richards -
Category
Documents
-
view
212 -
download
0
Transcript of Intro to WCF From the beginning and uses Steve Maier @YsFred4 [email protected] AppRochester.
![Page 1: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/1.jpg)
Intro to WCFFrom the beginning and uses
Steve Maier@YsFred4http://strugglingthru.net/[email protected]
![Page 2: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/2.jpg)
Before WCFSocketsNamed PipesTCPIPHTTPMSMQ
Everything had a different API that you had to learn.
Switching from one to another was not simple.
![Page 3: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/3.jpg)
With WCF we get…Consistent interface for all communication
TCPHTTPMSMQNamed PipesPeer-to-Peer
XML configuration to defineEndpoints, binding, behaviors, etc
Can use code behind instead of XML
![Page 4: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/4.jpg)
ABCs of WCFA – Address
the location of the service and the transport protocol used to communicate with the service
B – BindingHow do I talk to the serviceBasic binding, TCP binding
C – Contracta platform-neutral and standard way of describing
what the service does
![Page 5: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/5.jpg)
Examples of ABCs of WCFA – Address
net.tcp://localhost:8081/SpeakerServicehttp://localhost:49868/SpeakerService.svchttp://localhost:57402/TaPService.svc?wsdl
![Page 6: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/6.jpg)
Examples of ABCs of WCFB – Binding
netTcpBinding netPeerTcpBinding basicHttpBinding (SOAP compatible)mexHttpBindingmexHttpsBindingnetNamedPipeBindingmsmqIntegrationBinding
![Page 7: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/7.jpg)
Examples of ABCs of WCFC – Contract
[ServiceContract] public interface ISpeakerService {
[OperationContract] SpeakerInfo GetNextSpeaker();
[OperationContract] void AddSpeaker(SpeakerInfo newSpeaker);
[OperationContract] IEnumerable<SpeakerInfo> GetAllSpeakers();
}
![Page 8: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/8.jpg)
Service Configuration EditorWindows SDK ToolsAllows editing of the app.config to add
services
demo
![Page 9: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/9.jpg)
Service Configuration Editor (cont.)
![Page 10: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/10.jpg)
WCF is just a Web Service?Web Services WCF
Asmx svc but can be treated like an asmx
HTTP and stateless Different hosting environments
(IIS, apps, services)
SOAP (http and xml) Binary or text data
XmlSerializer DataContractSerializer
Exceptions are SOAP faults Exceptions can be configured to be handed
back to the client
![Page 11: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/11.jpg)
Hosting WCF ServicesWCF Services can be hosted in many
different things.IIS / Azure (ASP.NET project)AppsWindows Services
![Page 12: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/12.jpg)
Using WCF for a SingletonWCF can also be used to implement the
Singleton patternYes it is overkill, but it will work
Demo
![Page 13: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/13.jpg)
WCF as a Web ServiceHosted with IIS on a server or in the cloudASP.NET projects
Sync (default) or Async
Demo
![Page 14: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/14.jpg)
WCF Goes RESTfulNuGet package from MS for WCF REST
services
Demo
![Page 15: Intro to WCF From the beginning and uses Steve Maier @YsFred4 steve.maier@gmail.com AppRochester.](https://reader036.fdocuments.net/reader036/viewer/2022083008/56649e985503460f94b9b087/html5/thumbnails/15.jpg)
WCF FuturesWeb API
http://wcf.codeplex.com/Way to configure wcf for web messaging, even
form postsSimplified setupNuget WebApi.All
Jquery SupportJSON