W
William LaMartin
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>
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>