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-----------------------------------
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 -------------
<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------------------------------------
<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:
<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>