I've created new website ( not web project ), In solution explorer right click on project and clicked Add Service Reference
then I've add a web service provider address, a new folder named App_WebReferences created. It contains ServiceReference1 folder in which there are three files(two .svcinfo and one .wsdl).
Now I use this code as my provider guided:
var srv = new ServiceReference1.PaymentIFBindingSoapClient();
double result = srv.verifyTransaction(refNum, "10004738");
there is no error in compilation and running in localhost. BUT when I upload my website files to my ftp on the server..I get this error message:
*Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
**Compiler Error Message:** CS0246: The type or namespace name 'ServiceReference1' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 69: ///WebService Instance
Line 70: //
Line 71: var srv = new ServiceReference1.PaymentIFBindingSoapClient();
Line 72:
Line 73: double result = srv.verifyTransaction(refNum, "10004738");
Source File: d:\domains\olomrayaneh.net\wwwroot\ebook\check_payment.aspx.cs Line: 71
Show Detailed Compiler Output:
Show Complete Compilation Source:
Version Information: Microsoft .NET Framework Version:2.0.50727.3643; ASP.NET Version:2.0.50727.3634*
I've stuck in this problem. Whats the problem!? How should I solve it?
I should say that I tried to add this line:
using ServiceReference1;
then the error message line changes to this line with the same message !
and again no error message in localhost running!
my website is build in .Net Framework 3.5
web.config -- after adding server reference, these lines added to web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="PaymentIFBindingSoap" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="PaymentIFBindingSoap1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
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="https://acquirer.samanepay.com:2789/payments/referencepayment.asmx"
binding="basicHttpBinding" bindingConfiguration="PaymentIFBindingSoap"
contract="ServiceReference1.PaymentIFBindingSoap" name="PaymentIFBindingSoap" />
</client>
</system.serviceModel>
Thanks friends. I've solved it.
the problem was that I was copied all data to a subfolder under the wwwroot folder,
But I should copy the App_WebReference folder to the root of wwwroot folder !