VS. Net I can say it? (Talk about Web service)

zhaozj2021-02-17  77

VS. Net I can say it? (Talk about Web service)

The god of the small gas 2001.08.06

Not long ago, I wrote a copy of VS. Net Beta 2 to complete the entire process of a Web Service. This article is also related to Web Service, but the entire process of implementing Web Service is completely manual, and it can not depend on VS. Net developing tools. VS. NET development Web Service is very easy, and it also encapsulates many underlying information, it hopes that developers can concentrate on the main logic implementation and service itself. As for VS. Net you can say no, then you have to look at your own understanding, it's better to return, start to implement this web service.

First you have to successfully install Framework SDK Beta 2, then use NotePad, IIS, IE, DOS's Command Prompt can be completed. The entire function is still along the last example, a HelloWorld and Add, if you Download two zip packages, you will find that many of the code is the same. Especially the client, it doesn't care if you are using what you are using. The entire process is divided into the following steps: 1. Manually generate a .asmx file. 2. Set up your IIS server. 3. Test this Web Service 4 in your browser. Generate agent package 5. Write client code for testing. Simple look and last at VS. There is nothing difference in NET, the only thing is to set up IIS manually, in VS. The NET is set to the IIS by setting this page as a start page then f5. For the settings, DOTNET has many different ASPs or COMs, comprehensively introduced XML format, this is not here. We don't involve these.

Specifically: 1. Manually generate a .asmx file. In vs. It automatically generates a. ASMX file, which will also automatically generate a .asmx.vb or .asmx.cs file, which is also automatically generated, and you can also write it in this file. Of course you can also Write directly in the .asmx file so that IIS will compile this .asmx file for the first time, generate a DLL file in a specific directory. But I like to use IX. Net's way to implement, so more encapsulation, more secure in the actual application. The truth is like a start we have access to the database directly in the ASP, but naturally, it is used to complete these, and then call this component in the ASP. But if you use VS completely Net's approach is unable to compile. VS. NET in the .asmx file is like this: <% @ Webservice language = "VB" codebehind = "service1.asmx.vb" class = "WebService1.service1"%>, then a .vb file, but if we look It requires a multi-library file when compiling. You can do this, change this sentence into this: <% @ Webservice language = "VB" class = "MyWeWebService.service1, webservice1"%> MyWebService is namespace, service1 is the class name you implement service, WebService1 is You compile .vb into the name of the DLL. Then add these two sentences in your .asmx.vb: namespace mywebservice end namespace and then you will find me COPY original in VS. All code for implementing WebService in NET. You can then store, put it .asmx and .asmx.vb in a directory, such as: MyService, then prepare to compile this Web Service in DOS's Command. Use the compiled commands below: VBC / T: library /R :system.web.services.dll /r:System.dll /R:System.xml.dll /out :bin/webservice1.dll service1.asmx.vb Confirm that you are in this command in the MyService directory, which will find this DLL file in the subdirectory bin generated in this directory: WebService1.dll. If all this is no problem, then you have passed the first level.

转载请注明原文地址:https://www.9cbs.com/read-31054.html

New Post(0)