开发者

ASP.NET 2.0 - Add Web Reference does not generate asynchronous proxy code

开发者 https://www.devze.com 2022-12-18 12:00 出处:网络
I am trying to add a web reference to an ASP.NET 2.0 application in Visual Studio 2008. H开发者_运维知识库owever, the generated proxy classes do not include BeginXXXX and EndXXXX methods.

I am trying to add a web reference to an ASP.NET 2.0 application in Visual Studio 2008.

H开发者_运维知识库owever, the generated proxy classes do not include BeginXXXX and EndXXXX methods.

How can I get these to be generated? Do I need to manually use wsdl.exe?

(Incidentally in ASP.NET 3.5 apps, there is an option in the Add Service Reference box which lets me specify that Async methods should be generated. However, I am limited to ASP.NET 2.0 implementation).


If you use Visual Studio's 2008 Add Web Reference GUI it will not generate BeginXXX and EndXXX methods. You might need to directly call wsdl.exe (from the Visual Studio 2008 Command Prompt):

wsdl.exe http://www.example.com/someservice.asmx?wsdl

and include the resulting .cs file containing the proxy classes and the corresponding BeginXXX and EndXXX methods to your project.

Note: wsdl.exe might be located at C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin


Web services from 2.0 on generate different ASync methods through event handlers. The Begin/End methods shouldn't actually be necessary to complete an ASync proxy: http://www.codeguru.com/csharp/csharp/cs_webservices/security/article.php/c9179__1/

However, these methods auto-generate in the GUI. The nature of the web service should provide the interface with these methods through the metadata of the SoapHttpClientProtocol object.

If you write the service instantiation code in a file, you should be able to right-click the variable's type declaration and choose "Go To Definition". This will take you to the metadata generated when you added the service.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号