Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a web service using WCF which gets the data from SQL into sharepoint. I have hosted it in IIS. It works fine when I call the service in the browser. I can see the wsdl. I used an asp.net page to display data that the web service provides and that works fine too. Even tested on a windows form and there works fine.

Now, the problem starts when I use the same service in a visual web part in sharepoint . In the visual web part I have added a reference to the Web service which is hosted in IIS and when I try to get the data, I get this error message:

Server Error in '/' Application. 


The remote server returned an error: (404) Not Found. 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.Net.WebException: The remote server returned an error: (404) Not Found.
 Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The remote server returned an error: (404) Not Found.]

   System.Net.HttpWebRequest.GetResponse() +1126

   System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +81


[EndpointNotFoundException: There was no endpoint listening at http://:4588/WebHost/CustomersService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.]

   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +10260970

   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +539

   ORESBranding.CustomersService.ICustomersService.ListCustomers() +0

   ORESBranding.CustomersService.CustomersServiceClient.ListCustomers() +95

   ORESBranding.DossierCreationForm.DossierCreationFormUserControl.Button1_Click(Object sender, EventArgs e) +87

   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +115

   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +140

   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +29

   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2981
share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.