简体   繁体   中英

There was no EndPoint listening at http://localhost/Service1.svc

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

InnerException The remote server returned an error: NotFound

I have 2 solution projects

1. MyApp (Windows Application)

2. WcfService1 (Class library)

My Web.Config

<?xml version="1.0"?>
<configuration>

 <system.web>
      <compilation debug="true" targetFramework="4.0" />
 </system.web>

<system.serviceModel>

<client>
  <endpoint address="http://localhost:6272/Service1.svc" binding="basicHttpBinding"
    bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
    name="BasicHttpBinding_IService1" />
</client>

<behaviors>
  <serviceBehaviors>
    <behavior>
      <serviceMetadata httpGetEnabled="true"/>
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

<bindings>
  <basicHttpBinding>
    <binding name="BasicHttpBinding_IService1" closeTimeout="00:10:00"
      openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
      allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
  </basicHttpBinding>
</bindings>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
 </system.webServer>

 </configuration>

In my Service1.svc.cs I just returning CookiesContainer Object to client(MyApp) .

What should I do? Is there any change in my web.config file?

Your WcfService1 needs to be more than just a class library: you need to host the service somehow. There are a number of options, including using IIS and Self-Hosting. This is a little dated, but gives a good outline: http://msdn.microsoft.com/en-us/library/bb332338.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM