Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
I have developed an application in Asp.Net with jquery/Ajax. for database communication and complex logic, i have WCF Service. I have added the service as Service Reference in Web Application. When i made this project live, i stuck with a strange problem.

Most of time website is running smoothly. and sometime, it throws this below error and website gets down.

"There was no endpoint listening at http://www.example.com/All.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Server stack trace: at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream() at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message message, TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at ServiceReference2.IAll.GetBasicInformation(Stream strmdata) at SiteSetting.SetSiteBasicSetting()


if you need anything regarding this issue, raise you need.
Please help me asap. any help will be appreciated.


------------Just from Client code to consume service-----------------------------------

C#
XDocument miXML = new XDocument(
         new XDeclaration("1.0", "utf-8", "yes"),
         new XElement("GetHomeDetails",
         new XElement("GetHomeDetails",
         new XElement("ClientId", SiteConstant.GetClientID),
         new XElement("IPAddress", SiteConstant.IPAddress),
         new XElement("SessionKey", SiteConstant.GetSessionID),
         new XElement("APIKey", SiteConstant.APIKey),
         new XElement("APIPassword", SiteConstant.APIPassword)
        ))

      );

        byte[] bytes = System.Text.Encoding.Default.GetBytes(miXML.ToString());
        ServiceEndUsers.EndUsersClient objService = new ServiceEndUsers.EndUsersClient();

       XmlDocument xDoc = new XmlDocument();
        xDoc = objService.GetHomeDetails(bytes);


The above bold line throwing error.

--------------In Service code Service contract/Operation contract is as below-----------------

[OperationContract(Name = "GetHomeDetails")]
Stream GetHomeDetails(Stream strmdata);



-------------Service Configuration -------------


XML
<system.serviceModel>
   <bindings>
     <basicHttpBinding>
       <binding name="BasicHttpBinding_IEndUsers"/>
     </basicHttpBinding>
   </bindings>
   <client>
     <endpoint address="http://www.example.com/EndUsers.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEndUsers" contract="ServiceEndUsers.IEndUsers" name="BasicHttpBinding_IEndUsers"/>
   </client>
   <behaviors>
     <serviceBehaviors>
       <behavior name="">
         <serviceMetadata httpGetEnabled="true"/>
         <serviceDebug includeExceptionDetailInFaults="false"/>
       </behavior>
     </serviceBehaviors>
   </behaviors>
   <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
 </system.serviceModel>


--------------My Client Configuration------------------------------------


XML
<system.web>
    <customErrors defaultRedirect="pagenotfound" mode="On" redirectMode="ResponseRedirect"></customErrors>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="loginregister" timeout="2880"/>
    </authentication>
    <pages>
      <controls>
        <add tagPrefix="Ajax" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit"/>
        <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
       
      </controls>
    </pages>
    <httpRuntime executionTimeout="3600" maxRequestLength="102375"></httpRuntime>
    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
    </membership>
    <profile>
      <providers>
        <clear/>
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
      </providers>
    </profile>
    <roleManager enabled="false">
      <providers>
        <clear/>
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
      </providers>
    </roleManager>
  </system.web>

<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <handlers>
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource"/>
    </handlers>
    <httpErrors errorMode="DetailedLocalOnly">
      <remove statusCode="404" subStatusCode="-1"/>
      <error statusCode="404" prefixLanguageFilePath="" path="/pagenotfound" responseMode="ExecuteURL"/>
    </httpErrors>
    <defaultDocument enabled="true">
      <files>
      </files>
    </defaultDocument>
    <directoryBrowse enabled="false"/>
  </system.webServer>





I would like remind once again, my website usually running well. only some time, it is throwing error. it seems totally strange to me.

thank you.

--------------------------------------------------------------------------------------------

I have little experience on WCF configuration. Does it matter if have multiple endpoints like:


XML
<system.servicemodel>
    <bindings>
      <basichttpbinding>
 
        <binding name="BasicHttpBinding_INews" maxreceivedmessagesize="214748364" />
        <binding name="BasicHttpBinding_IPurchase" maxreceivedmessagesize="214748364" />
 
      </basichttpbinding>
    </bindings>
    <client>
      <endpoint address="http://www.example.com/News.svc" binding="basicHttpBinding" bindingconfiguration="BasicHttpBinding_INews" contract="ServiceNews.INews" name="BasicHttpBinding_INews" />
      <endpoint address="http://www.example.com//Purchase.svc" binding="basicHttpBinding" bindingconfiguration="BasicHttpBinding_IPurchase" contract="ServicePurchase.IPurchase" name="BasicHttpBinding_IPurchase" />
    </client>
    <behaviors>
      <servicebehaviors>
        <behavior name="">
          <servicemetadata httpgetenabled="true" />
          <servicedebug includeexceptiondetailinfaults="false" />
        </behavior>
      </servicebehaviors>
    </behaviors>
    <servicehostingenvironment multiplesitebindingsenabled="true" />
  </system.servicemodel>
Posted
Updated 8-Nov-13 5:53am
v5
Comments
Nelek 8-Nov-13 5:11am    
If you know which part of your code is throwing the error, it would be nice to have a look at it. you can add it using the "improve question" widget at the bottom of your post.
Mishra Laxmikant 8-Nov-13 6:41am    
Hi!!! any luck on this?
Pratik Bhuva 8-Nov-13 5:27am    
Show Your Web.config File of your WCF service AND your client.
problem is there in web.config.
Pratik Bhuva 8-Nov-13 7:39am    
Its strange that its working fine and sometimes it shows error.
i don't found any problem in your web.config file.
[no name] 16-Dec-13 2:51am    
sometimes it usually throws this type of error when your port is busy that time.

1 solution

this was because of network/bandwidth problem or some installed software was responsible. i restarted my server, and it seems successful till now, but still keep watching this scenario.
 
Share this answer
 

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