This article is a mirror article of machine translation, please click here to jump to the original article.

View: 29905|Reply: 3

[WCF/Web Servics] VS 2019 uses svcutil.exe tools to generate the call file

[Copy link]
Posted on 7/19/2020 10:39:24 PM | | | |
After creating a WCF service interface that allows other projects to call our WCF interface in languages such as C#/VB.NET, we can use svcutil.exe tools to generate the call file.

In the Start menu, find and type "Developer Command Prompt for VS 2019" (vs2019 Developer Command Prompt), as shown below:



The command is executed as follows:

The error is as follows:

Microsoft (R) Service Model Metadata Tool
[Microsoft(R) Windows (R) Communication Foundation, version 4.8.3928.0]
Copyright (C) Microsoft Corporation. All rights reserved.

Attempting to download metadata from the "http://localhost:3705/Service1.svc?wsdl" using WS-Metadata Exchange or DISCO.
Generating files...
Error: Unable to create output file: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Service1.cs

    Access to the path "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Service1.cs" is denied.
Solution:

Switch a directory and execute it again with the following command:


The results are as follows:

Microsoft (R) Service Model Metadata Tool
[Microsoft(R) Windows (R) Communication Foundation, version 4.8.3928.0]
Copyright (C) Microsoft Corporation. All rights reserved.

Attempting to download metadata from the "http://localhost:3705/Service1.svc?wsdl" using WS-Metadata Exchange or DISCO.
Generating files...
C:\Users\itsvse_pc\source\repos\dotnet-core-call-wcf\Service1.cs
C:\Users\itsvse_pc\source\repos\dotnet-core-call-wcf\output.config
The output.config file looks like this:







Previous:ASP.NET Core 3.1 Calling .NET 4.0 WCF Services tutorial
Next:Improve WCF security by prohibiting the generation of WSDL metadata
 Landlord| Posted on 11/17/2020 10:10:33 AM |
Generate the corresponding .cs file from the .wsdl file,Remember to use the VS Developer command-line tool to build, otherwise it will prompt that the wsdl command cannot be found.
'wsdl' is not an internal or external command, nor is it a runnable program

The command is as follows:



Parameter description:

/language:C#    指定编程语言为 C#
/n:DT   指定名称空间为 DT
/out:      指定文件保存路径和文件名 d:/UploadDataInterface.cs
http://localhost:63277/UploadDataInterface.asmx?wsdl 为wsdl文件路径,也可以是物理路径(如:C:/test.wsdl)


Posted on 3/19/2022 9:58:27 PM |
Xiexie! Take a look.
Posted on 5/25/2022 2:38:56 PM |
1111111111111
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com