首页 文章

远程服务器返回错误:NotFound . 在尝试获取自己的服务方法的结果时

提问于
浏览
0

当我想要使用我的方法时获取错误:

远程服务器返回错误:NotFound .

内部异常:

{System.Net.WebException:远程服务器返回错误:NotFound . ---> System.Net.WebException:远程服务器返回错误:NotFound . System.Net上的System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult),System.Net.Browser.AsyncHelper上的<> c__DisplayClass5.b__4(Object sendState) . <> c__DisplayClass2.b__0(Object sendState) ---内部异常堆栈跟踪的结束---在System.ServiceModel.Channels的System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)的System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod,Object state)中 . HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)}

当我想获得My方法的结果时,错误显示在这里 . 我自己的收藏可能是坏的? :

public SecretaryAppNav.ClientService.DzieckoAndOpiekunCollection EndGetChildAndOpiekunByFirstnameLastname(System.IAsyncResult result) {
        object[] _args = new object[0];
        SecretaryAppNav.ClientService.DzieckoAndOpiekunCollection _result = ((SecretaryAppNav.ClientService.DzieckoAndOpiekunCollection)(base.EndInvoke("GetChildAndOpiekunByFirstnameLastname", _args, result)));
        return _result;
    }

我的web.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <!--<system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Verbose,ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="MessageLog">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="E:\sql\UNI\projekt dyplomowy\SecretaryAppNavNewEF\SecretaryAppNav\WcfService1\Web_tracelog.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="MessageLog" traceOutputOptions="None">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>-->
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="WcfService1BasicHttpBindingConfig" maxBufferSize="200000"
          maxReceivedMessageSize="200000">
          <readerQuotas maxArrayLength="200000" maxStringContentLength="200000"/>
          <!--<security mode="Transport">
            <message algorithmSuite="Basic128" />
          </security>-->
        </binding>
      </basicHttpBinding>
    </bindings>
    <diagnostics>
      <messageLogging logEntireMessage="true" logMessagesAtServiceLevel="true"
        logMessagesAtTransportLevel="true" />
    </diagnostics>
    <behaviors>
      <endpointBehaviors>
        <behavior name="CrossDomainServiceBehavior">
          <webHttp/>
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="metadataBehavior">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
        multipleSiteBindingsEnabled="true" />
    <services>
      <service name="WcfService1.Service1">
        <endpoint address="" binding="basicHttpBinding" bindingConfiguration="WcfService1BasicHttpBindingConfig"
          contract="WcfService1.IService1" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/WcfService1/MyService" />
          </baseAddresses>
        </host>
      </service>
      <service name="WcfService1.CrossDomainService">
        <endpoint address="" behaviorConfiguration="CrossDomainServiceBehavior"
          binding="webHttpBinding" contract="WcfService1.ICrossDomainService" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
</configuration>

和客户端配置:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1" 
          maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost:11598/Service1.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IService1" contract="ClientService.IService1"
        name="BasicHttpBinding_IService1" />
    </client>
  </system.serviceModel>
</configuration>

1 回答

  • 0

    尝试添加additinal信息到配置:

    maxBufferSize =“2147483647”maxReceivedMessageSize =“2147483647”readerQuotas maxDepth =“2147483647”maxStringContentLength =“2147483647”maxBytesPerRead =“2147483647”maxArrayLength =“2147483647”

相关问题