.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

how to use svcutil.exe?

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :Windows Application


I am trying to generate a client for a webservice I'm creating and I'm having trouble with the svcutil.exe tool.

I want to output the client to a specific directory but I can't get it to work, here's what I'm using:


svcutil.exe http://localhost:49491/Service1.svc?wsdl /d G:\bkup


Any tips?

View Complete Post

More Related Resource Links

Deserializing Problem when build proxy by svcutil from WSDL

Hi, I got a WSDL from a third-party company and have to build a proxy to fetch data. I used svcutil *.wsdl to generate code and config file. Using the proxy I wondered why I got unexpected results: The return value is alway 0 and the string field CTWS_ReturnMsg always empty even if the server sent values. Could anybody help me? Here the WSDL and afterwards the http-traffic (from Wireshark): <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://CEITONWebService.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://CEITONWebService.org/">     <wsdl:types>         <xs:schema xmlns="http://CEITONWebService.org/" xmlns:mstns="http://CEITONWebService.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://CEITONWebService.org" targetNamespace=&q

SvcUtil-generated code or shared interface/data contract assembly?

If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

Why request parameter added to client side code in each method while using svcutil.exe

Hi, I am using WCF services in my project and want to call WCF methods asynchronously. I am hosting WCF service programmatically in windows app as follows svc = New ServiceHost(GetType(Service1), New Uri("net.tcp://localhost:8806/")) Dim svcMDB As New ServiceMetadataBehavior svc.Description.Behaviors.Add(svcMDB) svc.AddServiceEndpoint(GetType(Service1), New NetTcpBinding(), "MyBusiness/MyBusinessService/") svc.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), "MyBusiness/MyBusinessService/mex") svc.Open() Me.Text = "Service started...." and I am generating client side proxy using svcutil.exe as follows. svcutil /n:net.tcp://localhost:8806/MyBusiness/MyBusinessService,MyService net.tcp://localhost:8806/MyBusiness/MyBusinessService/mex /a /language:vb   The result of this command is as :   Microsoft (R) Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152] Copyright (c) Microsoft Corporation.  All rights reserved.   Attempting to download metadata from 'net.tcp://localhost:8806/MyBusiness/MyBusi nessService/mex' using WS-Metadata Exchange. This URL does not support DISCO. Generating files... D:\Prabodh\New C2k\Test Projects\DataTableToArray\MyHost\bin\Debug\MyBusinessSer vice.vb D:

Proxy Authentication in svcutil

Hi, i want to use svcutil (or VS2008 Add Service Reference) to generate a proxy client class for a internet public wcf service, the thing is im behind a proxy, and svcutil fails:    Error de la solicitud con el código de estado HTTP 407: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  ).And VS2008 also fails:The remote server returned an unexpected response: (407) Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied.  ).Error en el servidor remoto: (407) Se requiere autorización del proxy.How can i add a service reference or create a proxy class thru the proxy server ?Thanks!!

svcutil /metadata - how to export metadata for service contract that has generic type



I am using svcutil /metadata to get metadata for a WCF service project assembly, the service class implements the IChildServiceContract below, and the IChildServiceContract interface implements a base interface which accept a generic type.

public interface IChildServiceContract : IServiceBaseContract<string>

I can generate metadata for IChildServiceContract , I am curious and also want to try generate meta data for base interface, an error come up which seems have problem with the generic based contract:

There was an error exporting the contract loaded from the type: xxx.xxx.xxx.IServiceBaseContract`1

Is it possible to generate metadata in this situation?


Thanks in advanced


svcutil doesn't work


i have 2 xsd and now i want to generate with scvutil my classes but with one class works and one class it doesn't work. Both xsds are very similar and looks like these:


<?xml version="1.0" encoding="UTF-8"?>
  <xsd:complexType name="persona">
  <xsd:element name="id" type="xsd:int" />
  <xsd:element name="nome" type="xsd:string" />
  <xsd:element name="cognome" type="xsd:string" />

  <xsd:complexType name="personaId">
      <xsd:element name="id" type="xsd:int" />

Invoke WXF Service runtime without using SVCUTIL or addservice reference

Hi Guys,

I wanted to develop a wcf service and  i  wanted to invoke this wcf service in client application  by generating the proxy at runtime and use this proxy to incoke the methods of the WCF service. I have an idea how to develop wcf proxy  by using either SVCUtil.exe or Addservice Option in Visual studio. But My client wants to generate this proxy at runtime only as i have the service endpoint available to my client application .As I know the service Endpoint in my client applicatio( Like http://localhost/ HelloWcfservice/Service.svc)  ,now i have to use this service url and needs to generate the proxy class for this service and use this proxy to invoke the methods.

I got some basic info on this..is like this

As i have this Service URL ,I will get the Metadata of that service at runtime. and then from this Metadata i will generate a proxy and invoke the Methods of the service.  But i don't have any sample how i can do this .Can someone please help me with this how i can complete this task


Problem creating DataContract with SVCUTIL


I am trying to create a DataContract for a simple REST based webservice using a XSD file.

However when I run:

 svcutil /dconly .\workcodes.xsd /out:workcodes.cs

I get the following error message:

Error: Cannot read .\workcodes.xsd.

    Cannot load file C:\home\timesheet_webpart\workcodes.xsd as an Assembly. Check the FusionLogs for more Information.

    Could not load file or assembly 'file:///C:\home\timesheet_webpart\workcodes.xsd' or one of its dependencies. The module was expected to contain an assembly manifest.

I do not know why it would be trying to load the XSD as an assembly. I researched the issue and was unable to find a solution.

Can anyone shed some light on this issue? I have att

Can a WCF Server "Stub" be Generated from WSDL (eg. via svcutil) ?


What I would like to know is whether there is any tool out there that can generate a WCF Server stub for us, given WSDL & XSD. I am not talking about generating a client proxy - I am talking about generating the skeleton of a server (web service) based on supplied WSDL and XSD.

In other words it would generate a Service class, the Service data structures, the service interfaces etc, with the WCF appropropriate attributes applied where necessary to match the WSDL.

I realise it's an unusual request but we are needing to integrate with a web service that is not directly accessible to us (thinked locked down installation, defence etc) and we were thinking of building a "dummy version" of the web service (since it is very simple) so we can first test against it before moving onto the real thing.

Without this we will have to do most of our development on-site against the real web service, because it is not externally exposed.

The organisation has provided us, however, the WSDL and XSD files and whilst we can hand-craft a service and spend lots of time trying to make it identical to the supplied schemas, I thought a tool might be able to generate a WCF server skeleton for us easily.


Generation of proxy class using svcutil


Hello All,

I created a simple host application for hosting a class of mine. I have created endpoint, address binding and contract.

I am able to use svcutil to generate a proxy class. I am able to connect to the host application from my client, when both are put up onthe same machine. But when I try to host the application on my PC and try to obtain proxy class by running svcutil on someo ther machine, I am not able to generate the .cs and .config file.

Can u pls help.. as to what setting i have to change in order to generate the config file on the other machine.



Error Message - The document at the url ________ (request URL) was not recognized as a known document type.

-Report from the url __________ is ' The document format is not recognised ( the content type is text/htmll charset  = utf-8)

- Report from Disco Document = there was an error downloading ____ url ? disco

WCF client, svcutil and SOAP array problem


Hi, everyone. I hope someone will be able to help me about this issue:
I am trying to generate WCF client by issuing following command:
svcutil testingWsdl.wsdl /ser:XmlSerializer (/ser option has nothing with problem, I've just tried with it also)
I am getting following error:

Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: The datatype 'http://schemas.xmlsoap.org/soap/encoding/:Array' is missing.

Here is complete WSDL:

<?xml version="1.0"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" 
<import namespace="soap" location="http://schemas.xmlsoap.org/wsdl/soap/"/>
 <portType name="SoapInPort">
 <operation name="SoapIn">

XMLSerializer: Losing data from a generated web service proxy using svcutil


I generated a proxy using svcutil with the option ser:XmlSerializer.  When trying to serialize the object I am losing data.  The wsdl came from a .asmx web service.

SvcUtil question


Im trying to understand when and why to use the svcutil to generate a proxy class. What i do understand is, this class is required to communicate with the client app i.e.

Why would/should i create an app.config file using svcutil and not use Add Service Reference (in a VB forms app) and then create my client to get at the method i need?

Any advantages using one over the other or are they used for different purposes? Any help in understanding this would be great.


create proxy client with SvcUtil from service using https+cert authentication


Hi all,

I have build two web services one is wcf hosted in iis and the other one is java web service (jax-ws ri) hsted on tomcat. Both of the services uses https and certificate authentication.The certificates are valid and when I check the wsdl's from the browser I can see them without any warning.

So I want to create a wcf client for the services with svcutil. I have created the necessary config file for svcutil (svcutil.exe.config).

When I try to create the proxy files for the java service (svcutil http://JavaServiceIpAddress/service?wsdl) I receive

"metadata contains a reference that cannot be resolved .

<Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/" >
   <faultcode xmlns:a="http://www.w3.org/2003/05/soap-envelope" xmlns="">a:Client</faultcode>
   <faultstring xmlns="">Cannot find dispatch method for {}</faultstring>

the request was aborted: Could not create ssl/tls secure channel"


When I execute svcutil http://WcfServiceIpAddress/service.svc the proxy and configs file are created smoothly. When I try svcutil http://WcfServiceIpAddress/service.svc?wsdl

"error: cannot obtain metadata from http://WcfServiceIpAddress/service.svc?wsdl


svcutil only generates output.config


I am trying to generate the proxy class for a service using svcutil.  It runs fine but doesnt generate the proxy class, only the output.config file.  It's a pretty simple service.  Any Ideas?

svcutil ( wrong code) and add service reference (works smoothly)


Hi all,

I have a web service at java and I want to consume it with wcf. When I use add service reference to create the proxy everything works ok! When I tried to generate the proxy with svcutil it's generates me two files (*.cs and app.config) which I think is all I need. But nothing works, no errors but when I try to call the services I get nothing!!! But in the case you can't use add service reference (like an authenticated scenario which is the next step for me) what can I do? Why is this happening?Can someone help me?


SVCUtil changing CallBack interface method


I am creating a WCF duplex callBack structure, with a WPF app registering with a WCF service, and the WCF service using a CallBack in the WPF app to pass data from time to time. The interface for the callback in WCF is simple:

  void DataUpdate(string updatedData)

yet when I launch the service and run SVCUtil.exe, the CS code changes the callBack interface to

  void DataUpdate(DataUpdate request)

What is the cause of this? How can I get the proper structure to show in the SVCUtil output?



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend