Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Asp .net 2.0 Unable to Connect to Remote Server

Reply
Thread Tools

Asp .net 2.0 Unable to Connect to Remote Server

 
 
haroldbk
Guest
Posts: n/a
 
      07-06-2006
I have a small Asp .net 2.0 application with a web reference to a
Webservice.
Running locally works fine, but when I run it from the Web Server the
exception Unable to Connect to Remote Server is returned.

Tried 2 different Web Services - both locally on from the Web server.
This is a code snippet:
try

{

net.webservicex.www.CurrencyConvertor cc = new
net.webservicex.www.CurrencyConvertor();

cc.Url = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL";

net.webservicex.www.Currency dollar = net.webservicex.www.Currency.USD;

net.webservicex.www.Currency shekel = net.webservicex.www.Currency.ILS;

string rate = cc.ConversionRate(dollar, shekel).ToString();

Label4.Text = rate;

}

catch (Exception ex)

{

Label4.Text = ex.Message.ToString();

}



Any ideas?

Thanks,

Harold


 
Reply With Quote
 
 
 
 
Dale
Guest
Posts: n/a
 
      07-08-2006
When you set the URL property, you should probably leave off the ?WSDL. To
be more sure of what you should set the URL to, check the WSDL file for the
soap:address element.

Generally, for a .net web service, this is the asmx address but for other
web service providers, the WSDL address is used for setting the web reference
but when setting the URL you will use a completely different address - that
specified in the soap:address element.

HTH

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA


"haroldbk" wrote:

> I have a small Asp .net 2.0 application with a web reference to a
> Webservice.
> Running locally works fine, but when I run it from the Web Server the
> exception Unable to Connect to Remote Server is returned.
>
> Tried 2 different Web Services - both locally on from the Web server.
> This is a code snippet:
> try
>
> {
>
> net.webservicex.www.CurrencyConvertor cc = new
> net.webservicex.www.CurrencyConvertor();
>
> cc.Url = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL";
>
> net.webservicex.www.Currency dollar = net.webservicex.www.Currency.USD;
>
> net.webservicex.www.Currency shekel = net.webservicex.www.Currency.ILS;
>
> string rate = cc.ConversionRate(dollar, shekel).ToString();
>
> Label4.Text = rate;
>
> }
>
> catch (Exception ex)
>
> {
>
> Label4.Text = ex.Message.ToString();
>
> }
>
>
>
> Any ideas?
>
> Thanks,
>
> Harold
>
>
>

 
Reply With Quote
 
 
 
 
haroldbk
Guest
Posts: n/a
 
      07-21-2006
I found the answer.
I had to add the proxy server to the Web.config file.

Harold
"Dale" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> When you set the URL property, you should probably leave off the ?WSDL.
> To
> be more sure of what you should set the URL to, check the WSDL file for
> the
> soap:address element.
>
> Generally, for a .net web service, this is the asmx address but for other
> web service providers, the WSDL address is used for setting the web
> reference
> but when setting the URL you will use a completely different address -
> that
> specified in the soap:address element.
>
> HTH
>
> Dale
> --
> Dale Preston
> MCAD C#
> MCSE, MCDBA
>
>
> "haroldbk" wrote:
>
>> I have a small Asp .net 2.0 application with a web reference to a
>> Webservice.
>> Running locally works fine, but when I run it from the Web Server the
>> exception Unable to Connect to Remote Server is returned.
>>
>> Tried 2 different Web Services - both locally on from the Web server.
>> This is a code snippet:
>> try
>>
>> {
>>
>> net.webservicex.www.CurrencyConvertor cc = new
>> net.webservicex.www.CurrencyConvertor();
>>
>> cc.Url = "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL";
>>
>> net.webservicex.www.Currency dollar = net.webservicex.www.Currency.USD;
>>
>> net.webservicex.www.Currency shekel = net.webservicex.www.Currency.ILS;
>>
>> string rate = cc.ConversionRate(dollar, shekel).ToString();
>>
>> Label4.Text = rate;
>>
>> }
>>
>> catch (Exception ex)
>>
>> {
>>
>> Label4.Text = ex.Message.ToString();
>>
>> }
>>
>>
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Harold
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
smtp error: unable to connect to remote server...No connection could be made because the target machine actively refused it Homer ASP .Net 2 08-13-2007 05:39 PM
connect a database in remote server (can connect to the server via SSH) zhangxiaoyu912@gmail.com Perl Misc 2 07-18-2007 07:20 PM
underlying connection was closed: unable to connect to the remote server: COM --> .Net --> WebService --> Error Monty ASP .Net 3 09-28-2006 11:05 PM
The underlying connection was closed: Unable to connect to the remote server Marisha ASP .Net 0 03-27-2006 10:11 PM
Remote Assistance fails to connect, remote remote host name could not be resolved Peter Sale Wireless Networking 1 12-11-2004 09:09 PM



Advertisments