How to create a WCF service using SvcUtil.exe

I use SvcUtil.exe to create the IClassName.cs file from the wsdl file, and this works fine. My problem is that I do not know how to generate the ClassName.svc file using the command arguments for SvcUtil.exe.

After starting SvcUtil.exe, I would like to get the WCF service, for example, when you created from the Visual Studio Wizard containing all the * .svc, * .cs classes and the interface.

Thanks, Skrch

+4
source share
4 answers

First of all, to create a proxy class, we need to start our service. Therefore, before using this utility, make sure that your service works without any problems.

After checking the status of the service, go to Visual Studio Command Prompt and run the following command.

svcutil http://localhost/MyService/ClassName.svc /Language=c#
/t:Code /out:ClassNameProxy.cs /config:ClassNameProxy.config

In the command above, you must replace the service http://localhost/MyService/Service1.svcurl ( ) with the url of your service. Since my services are developed in C # .net, so I choose to generate proxies in one language using the / Language = C # flag.

/ t: code will indicate that the output should be generated as code.

Parameters

/out:ClassNameProxy.cs/config:ClassNameProxy.config will tell the utility the names of the files specified in these parameter values. After running the command, the tool will generate an output file and a configuration file.

ClassNameProxy.cs ClassNameProxy.config web.config.  , ClassNameProxy.vb , , . .

+12

,

svcutil http://service/metadataEndpoint - - .

svcutil *.wsdl *.xsd /language:C# - .

svcutil /dconly *.xsd /language:VB - VisualBasic .

svcutil /t:metadata http://service/metadataEndpoint -

svcutil myAssembly.dll -  

svcutil myServiceHost.exe /serviceName:myServiceName -  

svcutil myServiceHost.exe/dconly  -

svcutil /validate /serviceName:myServiceName myServiceHost.exe -

svcutil /t:xmlserializer myContractLibrary.exe - XmlSerializer,  

+5

, 2012 , Visual Studio 2015 .Net 4.5 svcutil.exe /serviceContract , . svc. /syncOnly/wrapped/messagesContract , XSD

+2

, .NET 4.5 Contract First Tool, Visual Studio 2012 , .

. .NET Framework 4.5 , . , , XML (XSD) ; HTTP.

http://msdn.microsoft.com/en-us/library/hh674270 (v = vs .110).aspx

0

Source: https://habr.com/ru/post/1542941/