Xorandor
Xorandor

Reputation: 462

Use svcutil.exe with a webproxy

I have a scenario where I need to consume a service using svcutil.exe but the wsdl of the service contains the following sections

<xsd:schema targetNamespace="http://tempuri.org/Imports">
  <xsd:import schemaLocation="http://mysite/service.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
  <xsd:import schemaLocation="http://mysite/service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
  <xsd:import schemaLocation="http://mysite/service.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Pensjonskalkulator"/>
  <xsd:import schemaLocation="http://mysite/service.svc?xsd=xsd3" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>

Problem is that these schema locations are only accessible through a webproxy. If I setup the proxy in IE settings I can browse the schema locations in IE. But it looks like svcutil.exe ignores these settings when downloading these extra schemas.

How do I get svcutil.exe to use my webproxy when downloading extra information?

UPDATE: Actually, the proxy settings entered in Internet Explorer works on svcutil.exe. It was other unrelated issues that caused my problems.

Upvotes: 2

Views: 1813

Answers (2)

rene
rene

Reputation: 42414

You can add this to svcutil.config

<system.net>   
  <defaultProxy>     
     <proxy proxyaddress="http://your.proxy.com:8080"  bypassonlocal="true" /> 
  </defaultProxy>
</system.net>

If your proxy requires authentication refer to this answer to provide a username/password and/or domain.

Upvotes: 1

Xorandor
Xorandor

Reputation: 462

It is possible to specify a proxy for svcutil.exe to use by setting it up in Internet Explorer -> Tools -> Internet Options -> Connections -> LAN Settings -> Proxy Server and then specify address and port.

Upvotes: 1

Related Questions