我尝试在演示应用程序中设置WCF服务,当我在应用程序中测试它时,它在运行时工作正常。然后我创建了相同的服务并尝试将它应用于dojo应用程序,我从xhrpost函数调用服务并发生以下错误
Failed to load resource: the server responded with a status of 404
(Not Found) http://localhost:51541/Service1.svc/load_data
在浏览器http://localhost:56252/Service1.svc
中打开后,我使用wcftestclient.exe对其进行了测试,其中的所有方法都有效。我在这里缺少什么。
webconfig部分:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
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>
<client>
<endpoint address="http://locaxxxxx:56252/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
name="BasicHttpBinding_IService1" />
</client>
编辑:
我发现它引用了另一个端口,但在删除了另一个项目后,我现在收到了以下错误:
Failed to load resource http://localhost:56252/Service1.svc/load_data