Webservice URL appends port when adding a reference in my application - c#

I have developed a simple .asmx webservice and hosted it on my server. The local machine url of the service is http://192.168.1.34:1115/webservices/verify.asmx.
I have given this a public IP so we can access it from anywhere like http://104.32.43.21/webservices/verify.asmx
when I hit the public url from my browser it works fine and the service page shown.
But when I try to add a reference of this service in my asp.net application, the port number 1115 gets appended to the service url and it shows an error in downloading the wsdl file from the server saying unable to resolve the host.
can someone tell me what is happening here and how can I access the webservice.
Thanks

There was problem in the way I was trying to add the service reference to my application. When ever adding an ASMX service reference add it with appending ?wsdl at the last of the service URL.
For my case it should have been like: http://104.32.43.21/webservices/verify.asmx?wsdl.

Related

ASP.NET, C#, RavenDB: error when running a web service located on another computer

Hello everyone.
I have implemented an ASP.NET web service that performs a query on a RavenDB database. I have then called this service by clicking on a button of a web page that is part of my web site and it is working just fine. I have generated a package from this web site. I have imported this package on IIS 8 located in another machine of the network I am connected to. On this other machine, when I launch the web site, is it working, but when I try to access the service by clicking on a button of a web page, I get the error displayed in the enclosed file. Is this error due to the fact that the web site is unable to locate the web service? If so, how can I fix it? If not, where does this error comes from?
Thanks in advance.

Get URL of Website from where Web Service Call is Made

In my web service, how can I check the URL of the web site from where the web service call originated please? Thank you.
In your scenario I think you have a web application hosted in IIS and that web application is consuming asmx web services and you need to get the name of the page which called the service in the service implementation.
The ASMX webservices are not limited to access from the web sites. They can be accessed from the desktop applications as well which don't have webpage url. So in this context we expect to get the web page URL as is inside the web service implementation. You may get the IP address of the caller machine. But seems that is not enough.
So only way is to pass the name of the webpage from the calling code via parameter or http header.
I believe what you're asking is for the requesting URL of the Web service called.
webpage.aspx -- (calls ) --> MyWebService.asmx.
the referrer is webpage.aspx
Try using Context.Request.UrlReferrer from the webservice.

Adding Web Reference to a secure http web service

I have a WCF client from which i am supposed to communicate to a thirdparty web service whose url and wsdl is disclosed.The third party WebService(.asmx) uses https. All I am doing is trying to add service reference from my dev environment ,but unable to succeed.So i went ahead and used SOAPUI to test the service where i am able to fire a request and got a response.
Is it not possible in VS2010 to add the service reference in order to access the metadata of a HTTPS web service ? Since this is the first time I am using HTTPS ,i would be glad if some one can guide me the right way ?
#Aron :I tried to get the same by using a web browser and i selected proceed anyway option then it takes me to the WSDL page.
I will assume that you are running your development server on your local dev machine. You should check the actual address that the IIS server is setup for. Open up the page in your web browser. You will have a page that asks you if you want to proceed anyway, DONT.
View server certificate.
Here is the GMail certificate. Notice the "issued to:". This means that the certificate is only for https://mail.google.com. If another server tried to use it for another address you would have the same error.
So you want to use whatever is in there as your https://{my issued to}/Webservice.asmx

Problem to see Web Services running on local machine

I have written some web service, I run it and see it from my firefox and run it from there.
Now I want to call it from some other code/solution i trying to add there a web reference and Web Services on the Local Machine , but i cannot see there my web services.
Any idea what is missing ? Sorry for the newbie question it's my first time with web services.
Thanks.
when you run the web service you will get a url in browser.Copy that, in reference of your project Add Webreference , it will ask for the url paste it and click go.Add that to your project.
If you are not added in IIS. please add it to IIS and do the rest of operation.other wise when you try for that you wont get the web service.
Or run web service in visual studio debugger and dont close and to the operations.
please also ref: http://msdn.microsoft.com/en-us/library/d9w023sx(VS.80).aspx
If you created the Web service project in a file system, then it ll automatically assign the temporary port number to run the service. In this case you cannot see the service in other projects.
Try creating the IIS virtual directory for the web service and see.

deploying precompiled WCF REST service error "service not defined"

I created an ASP.NET REST service (using WCF) and access it through one of my .aspx page.
the problem is that when I publish (precomile) my code to the web server, I get an error :
"ThunServ not defined" in the Javascript console of my browser.
don't know what's causing it and how to solve it.
It means that the WCF service isn't initializing correctly, and so the client-side object that represents it isn't being created in Javascript.
Make sure your web.config contains the proper bindings and endpoints for the service. Then try testing its ASMX file on the server to see if you can get the client-side script to generate, e.g. http://myserver/myapp/myservice.asmx/js. If it doesn't generate, you should get an error (you'll need to turn on debugging in the web.config to read it) telling you what went wrong.

Categories