简体   繁体   中英

Access WCF service through ASP.NET

I have a WCF service which I would like to access using ASP.NET. The binding used in the WCF service is basicHttpBinding . How may I do it? Any examples will be really appreciated.

Will it work fine if I create a proxy from the svcutil.exe and then use that class in an ASP.NET page?

You can access a WCF service in (the codebehind of) an ASP.NET application just like in any other .NET application type. Just add the service reference to the Project and instantiate the proxy.

您需要在asp.net网站项目(此处称为ServiceReference1)中添加服务引用,然后是您的客户端:

var serviceClient = new ServiceReference1.Service1Client();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM