[英]Access WCF service through ASP.NET
I have a WCF service which I would like to access using ASP.NET. 我有一个WCF服务,我想使用ASP.NET访问。 The binding used in the WCF service is basicHttpBinding .
WCF服务中使用的绑定是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? 如果我从svcutil.exe创建代理,然后在ASP.NET页中使用该类,是否可以正常工作?
You can access a WCF service in (the codebehind of) an ASP.NET application just like in any other .NET application type. 您可以像访问任何其他.NET应用程序类型一样在ASP.NET应用程序中(位于代码背后)访问WCF服务。 Just add the service reference to the Project and instantiate the proxy.
只需将服务引用添加到Project并实例化代理。
您需要在asp.net网站项目(此处称为ServiceReference1)中添加服务引用,然后是您的客户端:
var serviceClient = new ServiceReference1.Service1Client();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.