没有端点侦听可以接受该消息的 http:// localhost:6272 / Service1.svc 。 这通常是由错误的地址或SOAP操作引起的。见InnerException, 如果有,请了解更多详情。
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 对象返回客户端(MyApp)。
我该怎么办?我的 web.config 文件有没有变化?
答案 0 :(得分:0)
您的WcfService1需要的不仅仅是类库:您需要以某种方式托管服务。有许多选项,包括使用IIS和自托管。这有点过时,但给出了一个很好的轮廓:http://msdn.microsoft.com/en-us/library/bb332338.aspx