Publish WCF in IIS
1.Confirm IIS is enable in local
2.Confirm WCF Service is enable in IIS
3.Add a Site in Application pool
4.Add Mime Type of svc File in IIS
Open Vs command :
C:\> DISM /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation
C:\> DISM /Online /Enable-Feature /FeatureName:WCF-HTTP-Activation45
Note:
1. before publish WCF service , confirm you arerunning as administrator opened visual studio .
2. For Win8 + vs2010 , Need to install vs2010 SP1 , For win8 , another choice is using vs2012
3 ways to Consume WCF Service
1.Add Service Reference
static void Main(string[] args)
{
var proxy = new ServiceReference1.LocalWcfClient();
var result = proxy.GetData(1);
Console.WriteLine(result);
Console.ReadLine();
}
2.Using channel Factory
Config :
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ILocalWcf"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:80/WcfLocalTestService.svc"
binding="basicHttpBinding"
contract="LocalWcfTestLibrary.ILocalWcf"
name="BasicHttpBinding_ILocalWcf"/>
</client>
</system.serviceModel>
Code:
static void Main(string[]args)
{
var proxy = new ChannelFactory<ILocalWcf>(
"BasicHttpBinding_ILocalWcf").CreateChannel();
var result = proxy.GetData(1);
Console.WriteLine(result);
Console.ReadLine();
}
3.Using wsdl.exe generate WSDL proxy
a.
wsdl.exe /out:(no space)proxy.cs(exist file) http://localhost/localWcfService1.svc?wsdl
b.add proxy.cs into project
c.invoke:
static void Main(string[] args)
{
var proxy = new WcfLocalClient();
var content =
proxy.GetData(2, true);
Console.WriteLine(content);
Console.ReadLine();
}
分享到:
相关推荐
WCF Slide and Source
Hailed as the definitive treatment of WCF, this book provides unique insight, rather than documentation, to help you learn the topics and skills you need for building WCF-based applications that are ...
WebSockets, WCF, and Silverlight 5
Programming WCF Services: Design and Build Maintainable Service-Oriented Systems 4th Paperback: 1018 pages Publisher: Media; 4 edition (November 30, 2015) Language: English ISBN-10: 1491944838 ISBN-13...
this guide provides unique insight, rather than documentation, to help you learn the topics and skills you need for building maintainable, extensible, and reusable WCF-based applications. Authors ...
wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例wcf经典实例
一套简单的 WCF 宿主 !一套简单的 WCF 宿主 !一套简单的 WCF 宿主 !一套简单的 WCF 宿主 !一套简单的 WCF 宿主 !一套简单的 WCF 宿主 !
UDP push Client WCF push Client wcf publish Azure project
wcf 代理 wcf开发示例 wcf 代理 wcf开发示例
Hailed as the definitive treatment of WCF, this book provides unique insight, rather than documentation, to help you learn the topics and skills you need for building WCF-based applications that are ...
This book is a step-by-step tutorial to guide you through learning WCF, Entity Framework, LINQ, and LINQ to Entities. You will be guided to create six WCF and Entity Framework solutions from scratch, ...
NetCFSvcUtil exe is the analogous of Svcutil exe but for devices You can use it to generate a WCF client from a WCF service You can then consume the generated client code in a Windows Mobile ...
[奥莱理] RESTful .NET Build and Consume RESTful Web Services with .NET 3.5 ============================================================ [Packt Publishing] WCF 4.0 开发 SOA 程序经典实例 (英文版) [Packt...
■Chapter 1: WCF and SOA Basics ■Chapter 2: What’s New in WCF 4 ■Chapter 3: Exploring the WCF Programming Model Part II: Programming with WCF ■Chapter 4: Installing and Creating WCF Services ...
wcf教程,基础,事件,高级,扩展,每章都有代码,由浅入深,很好的WCF编程教材。
If you are a C#, VB.NET, or C++ developer and want to get started with WCF and Entity Framework, then this book is for you. Competence in Entity Framework will be needed to follow the examples in the ...
Linq SQL WCF and DataGrids
erage to the possibilities and practical aspects of using WCF: how to apply the tech- nology and how to choose among the available design and programming models. It makes the most of what .NET 4.0 and...
<br>This article is about how to create a peer-to-peer chat application using Windows Communication Foundation (WCF) and also how to make it look nice using Windows Presentation Foundation (WPF)....