在 http://localhost:6272/Service1.svc 上没有侦听端点可以接受消息。 这通常是由不正确的地址或 SOAP 操作引起的。请参阅内部异常, 如果存在,请了解更多详细信息。
InnerException 远程服务器返回错误:NotFound
我有 2 个解决方案项目
1.MyApp(Windows 应用程序)
2.WcfService1(类库)
我的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>
在我的 Service1.svc.cs 中,我只是将 CookiesContainer 对象返回到 client(MyApp)。
我该怎么办?我的 web.config 文件有任何变化吗?
您的 WcfService1 需要的不仅仅是一个类库:您需要以某种方式托管该服务。有多种选择,包括使用 IIS 和自托管。这有点过时,但给出了一个很好的概述:http://msdn.microsoft.com/en-us/library/bb332338.aspx