Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have made a simple MVC project and added a .svc file to it and trying to call the function under the .svc file from another client project but every time i am getting the error for

Additional information: There was no endpoint listening at http://localhost:61787/Service1forImages.svc/GetData that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.r more details.


There is my client web.config file


XML
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=301880
  -->
<configuration>
  <configsections>
    &lt;!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --&gt;
    <section name="entityFramework">
      type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      requirePermission="false"/&gt;
  </section></configsections>
  <connectionstrings>
    <add name="DefaultConnection" connectionstring="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-testforWCFService-20160328043116.mdf;Initial Catalog=aspnet-testforWCFService-20160328043116;Integrated Security=True">
      providerName="System.Data.SqlClient" /&gt;
  </add></connectionstrings>
  <appsettings>
    <add key="webpages:Version" value="3.0.0.0" />
    <add key="webpages:Enabled" value="false" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appsettings>
  <system.web>
    <authentication mode="None" />
    <compilation debug="true" targetframework="4.5.2" />
    <httpruntime targetframework="4.5.2" />
  </system.web>
  <system.webserver>
    <modules>
      <remove name="FormsAuthentication" />
    </modules>
  </system.webserver>
  <runtime>
    <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentassembly>
        <assemblyidentity name="Microsoft.Owin.Security" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-3.0.1.0" newversion="3.0.1.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="Microsoft.Owin.Security.OAuth" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-3.0.1.0" newversion="3.0.1.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="Microsoft.Owin.Security.Cookies" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-3.0.1.0" newversion="3.0.1.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="Microsoft.Owin" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-3.0.1.0" newversion="3.0.1.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="Newtonsoft.Json" culture="neutral" publickeytoken="30ad4fe6b2a6aeed" />
        <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="System.Web.Optimization" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-1.1.0.0" newversion="1.1.0.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="WebGrease" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-1.5.2.14234" newversion="1.5.2.14234" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="System.Web.Helpers" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="System.Web.Mvc" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-5.2.3.0" newversion="5.2.3.0" />
      </dependentassembly>
      <dependentassembly>
        <assemblyidentity name="System.Web.WebPages" publickeytoken="31bf3856ad364e35" />
        <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0" />
      </dependentassembly>
    </assemblybinding>
  </runtime>
  <entityframework>
    <defaultconnectionfactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantname="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityframework>
  <system.codedom>
    <compilers>
      <compiler language="c#;cs;csharp" extension=".cs">
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701"/&gt;
      <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb">
        type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/&gt;
    </compiler></compiler></compilers>
  </system.codedom>
  <system.servicemodel>
    &lt;!--<bindings>
      <wshttpbinding>
        <binding name="ota2010AEndpoint" closetimeout="00:01:00" opentimeout="00:01:00">
            receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
            transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
            allowCookies="false"&gt;
          <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384">
              maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
          <reliablesession ordered="true" inactivitytimeout="00:10:00">
              enabled="false" /&gt;
          <security mode="Transport">
            <transport clientcredentialtype="None" proxycredentialtype="None">
                realm="" /&gt;
            <message clientcredentialtype="Windows" negotiateservicecredential="true">
                establishSecurityContext="true" /&gt;
          </message></transport></security>
        </reliablesession></readerquotas></binding>
      </wshttpbinding>
    </bindings>--&gt;
    <behaviors>
      <endpointbehaviors>
        <behavior name="restfulBehavior">
          <webhttp />
        </behavior>
      </endpointbehaviors>
    </behaviors>
    <client>
      &lt;!--<endpoint address="http://localhost:57608/Service1.svc" binding="wsHttpBinding" bindingconfiguration="ota2010AEndpoint" contract="ExternalService.IService1" name="IPresidentsService" kind="" endpointconfiguration="" behaviorconfiguration="restfulBehavior">
        <identity>
          <dns value="localhost" />
          <certificatereference storename="My" storelocation="LocalMachine" x509findtype="FindBySubjectDistinguishedName" />
        </identity>
      </endpoint>--&gt;
      <endpoint address="http://localhost:61787/Service1forImages.svc" binding="webHttpBinding" bindingconfiguration="" contract="ServiceReference1.IService1forImages" name="IPresidentsService" kind="" endpointconfiguration="" behaviorconfiguration="restfulBehavior">
        <identity>
          <dns value="localhost" />
          <certificatereference storename="My" storelocation="LocalMachine" x509findtype="FindBySubjectDistinguishedName" />
        </identity>
      </endpoint>
    </client>
  </system.servicemodel>
</configuration>


This is my Service web.config file


<system.servicemodel>
    <behaviors>
      <endpointbehaviors>
        <behavior name="webHttpEnablingBehaviour">
          <webhttp />
        </behavior>
      </endpointbehaviors>
      <servicebehaviors>
        <behavior name="webHttpEnablingBehaviour">
          <servicemetadata httpgetenabled="true" httpsgetenabled="true" />
          <servicedebug includeexceptiondetailinfaults="false" />
        </behavior>
      </servicebehaviors>
    </behaviors>
    <services>
      <service name="Web.DynamicImage.Service1forImages" behaviorconfiguration="webHttpEnablingBehaviour">
        <endpoint address="" behaviorconfiguration="webHttpEnablingBehaviour" binding="webHttpBinding" contract="Web.DynamicImage.IService1forImages">
          <identity>
            <dns value="localhost" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseaddress="http://localhost:61787/Service1forImages.svc" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.servicemodel>

What I have tried:

I have trying to call same service with a wcf project it is working well but when i calling a adding a single .svc file to project and calling its function it is generating errors.
Posted
Updated 29-Mar-16 2:09am
v4
Comments
CHill60 29-Mar-16 8:51am    
Post details of the Inner exception.
Is Service1forImages.svc actually running? You may need to restart the service.

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