Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello Guys,

I have stuck in a problem from the past three days.
I have created a wcf service which includes some
[OperationContract]
methods.
And through my mvc application using jquery ajax I am able to send both type of requests (GET, POST) to the wcfservice on by using localhost or 127.0.0.1. But I am not able to send a request when I use my own IPAddress like http://192.168.18.5:15000/GetData.

Please guys help to solve this problem.

Thanks in advance.
Posted

1 solution

As we know ajax calls will not work for cross domain request. Here what i guess this is the cross domain issue what you are facing.

Like if your application is run as localhost then the service also should be called as localhost.
Same for IP address also, if you will running the application in localhost but trying to fetch the service by giving IP address it will not work.

Please have alook into the below link and please let me know if this solves your issue :-
http://stackoverflow.com/questions/13480652/jquery-ajax-call-to-c-sharp-web-service-error[^]

Hope this will be helpful for you.
 
Share this answer
 
Comments
leonidasvijay 27-Jun-14 1:31am    
Thanks for reply.
I have already resolved the cross domain issue for my applications. Actually both of my applications are in different solutions. I added global asax file and wrote the httpheaders in my service to enable the cross domain ajax requests.
When I try running my wcf service over ipaddress instead of localhost, even after configuring it on IIS express, it says 'HTTP Error 400. The request hostname is invalid.'. I dont understand where I am getting stuck.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900