Calling web services dynamically from a console ap

2019-04-15 04:04发布

I am using this example from microsoft to call web services dynamically using reflection:

http://blogs.msdn.com/b/kaevans/archive/2006/04/27/dynamically-invoking-a-web-service.aspx

Which works fine in a web page project, however in a console application the class

ServiceDescriptionImporter

Is unavailable (doesnt come up in intellisense and isnt recognized as part of the assembly it belongs to -- System.Web.Services.Description). Which is wierd b/c it DOES come up in web projects.

Anyone know why this is? I cannot get the console app to work. This is a VS 2010 project.

2条回答
不美不萌又怎样
2楼-- · 2019-04-15 04:19

ServiceDescriptionImporter is in the System.Web.Services assembly. Add a reference to that, and import the namespace with a using System.Web.Services.Description; statement, and it will work.

查看更多
贪生不怕死
3楼-- · 2019-04-15 04:34

I also met this problem. when I went to change the target framework, I found the default target is .Net Framework 4 client profile, also there has a .Net Framework 4 exist. I changed the target from .Net Framework 4 client profile to .Net Framework 4, and then it's working, the ServiceDescriptionImporter appeared. hope this helps for others.

查看更多
登录 后发表回答