Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Consuming a web service in VS 2008 ASP.Net project

Reply
Thread Tools

Consuming a web service in VS 2008 ASP.Net project

 
 
William LaMartin
Guest
Posts: n/a
 
      03-24-2009
In Visual Studio 2008, consuming a web service is a bit different from in VS
2005 in an ASP.Net project.

It goes something like this

Dim ds As New Data.DataSet
Dim url As New
System.ServiceModel.EndpointAddress("http://www.MyService.asmx")
Dim ws As New MyService.Service1SoapClient("Service1Soap")
ws.Endpoint.Address = url

ds = ws.GetData()

where GetData is a method of the service that returns a dataset.

My problem is that the application runs fine from within Visual Studio, but
when I deploy it, I will receive the error message:

"Could not find endpoint element with name 'Service1Soap' and contract
'MyService.Service1Soap' in the ServiceModel client configuration section.
This might be because no configuration file was found for your application,
or because no endpoint element matching this name could be found in the
client element. "

unless I copy what is below from the web.config of the Visual Studio project
and add it to the Web.config of the web site. I don't really like doing
this, since I can foresee a problem if I add many applications to the site
that use web services.

Is there another way--like a configuration file that can go inside the
application folder at the site?

<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Service1Soap" closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="4000000" maxBufferPoolSize="524288"
maxReceivedMessageSize="4000000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://www.MyService.asmx"
binding="basicHttpBinding" bindingConfiguration="Service1Soap"
contract="MyService.Service1Soap" name="Service1Soap" />
</client>
</system.serviceModel>


 
Reply With Quote
 
 
 
 
Mr. Arnold
Guest
Posts: n/a
 
      03-24-2009

"William LaMartin" <> wrote in message
news:%...
> In Visual Studio 2008, consuming a web service is a bit different from in
> VS 2005 in an ASP.Net project.
>
> It goes something like this
>
> Dim ds As New Data.DataSet
> Dim url As New
> System.ServiceModel.EndpointAddress("http://www.MyService.asmx")
> Dim ws As New MyService.Service1SoapClient("Service1Soap")
> ws.Endpoint.Address = url
>
> ds = ws.GetData()
>
> where GetData is a method of the service that returns a dataset.
>
> My problem is that the application runs fine from within Visual Studio,
> but when I deploy it, I will receive the error message:
>
> "Could not find endpoint element with name 'Service1Soap' and contract
> 'MyService.Service1Soap' in the ServiceModel client configuration section.
> This might be because no configuration file was found for your
> application, or because no endpoint element matching this name could be
> found in the client element. "
>
> unless I copy what is below from the web.config of the Visual Studio
> project and add it to the Web.config of the web site. I don't really like
> doing this, since I can foresee a problem if I add many applications to
> the site that use web services.
>
> Is there another way--like a configuration file that can go inside the
> application folder at the site?


No, a Web application with a Web.config is the root configuration file, and
it has to be in that config file and nowhere else, that I know about.

If you're complaining about this, wait until you see what has to be in
ASP.Net's Web.config and what must be in a WCF's Web service Web.config to
consume a WCF Web service.



 
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
Consuming local web service - ok, remote web service -problem? dgleeson422111 ASP .Net Web Controls 0 01-26-2010 11:17 AM
Error Consuming Web Service from WIndows application when WebService is using Custom Service Account ( Create an Application Pool with a Custom Identity) DNB ASP .Net Security 1 01-22-2008 09:08 PM
Error Consuming Web Service from WIndows application when WebService is using Custom Service Account ( Create an Application Pool with a Custom Identity) DNB ASP .Net Web Services 1 01-20-2008 01:47 PM
2008 new year,2008 new business, 2008 new life, much cheap andbeautiful product will help you yhnetstore@gmail.com Digital Photography 0 01-07-2008 04:57 PM
SOAP Header in a Dot Net 2.0 Web Service Client Consuming a WCF 3.0 service. Curt K ASP .Net Web Services 3 06-15-2007 10:19 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57