从IIs托管的WCF服务应用程序获取错误的地址或soap操作 [英] Getting incorrect address or soap action in response from IIs hosted WCF Service application

查看:82
本文介绍了从IIs托管的WCF服务应用程序获取错误的地址或soap操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有IIS托管的WCF应用程序和svc文件是:

I have IIS Hosted WCF application and svc file is:

<%@ ServiceHost Language="C#" Debug="true" Service="Spectrum.SpectrumService.SpectrumService" CodeBehind="SpectrumService.cs" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>



WCF服务应用程序中的Web.config文件


Web.config file in WCF Service Application

<configuration>
  <system.serviceModel>

    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBinding" 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>

    <behaviors>
      <serviceBehaviors>
        <behavior name="AspNetAjaxBehavior" >
          <serviceMetadata httpGetEnabled="true" />
        </behavior>
      </serviceBehaviors>

      <endpointBehaviors>
        <behavior name="AspNetSOAPBehavior">
        </behavior>
      </endpointBehaviors>
    </behaviors>

    <services>
      <service name="Spectrum.SpectrumService.SpectrumService" behaviorConfiguration="AspNetAjaxBehavior" >
        <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
        <endpoint address="soapreq" behaviorConfiguration="AspNetSOAPBehavior" bindingConfiguration="basicHttpBinding"

                  binding="basicHttpBinding" contract="Spectrum.SpectrumService.IUserSpectrumService" name="BasicHttpBinding_IUserSpectrumService" />
      </service>
    </services>
  </system.serviceModel>
</configuration>



我从服务中调用一个方法/>


I call a method from service

UserSpectrumServiceClient client = new UserSpectrumServiceClient();            
            lblName.Text = client.UserRegistration();            
            client.Close();





当方法UserRegistration调用时我收到以下错误



在http:// localhost:2639 / SpectrumService.svc上没有可以接受该消息的端点。这通常是由错误的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。



如何解决此问题?请帮助我。



when method UserRegistration called I get following error

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

How to resolve this issue? Please help me.

推荐答案

将此位添加到< system.servicemodel>中的web.config文件中。这里的地址是您的网络服务的位置。



Add this bit to your web.config file in <system.servicemodel>. Here address is the location of your web service.

<client>
      <endpoint address="http://localhost:2639/SpectrumService.svc">
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IUserSpectrumService"
        contract="Spectrum.SpectrumService.IUserSpectrumService" name="BasicHttpBinding_IUserSpectrumService" />
    </endpoint></client>


这是我的服务配置我也收到此错误

this is my service config i also getting this error
<system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="WebBehavior">
          <!--<enableWebScript/>-->
          <webHttp automaticFormatSelectionEnabled="false" helpEnabled="true" defaultOutgoingResponseFormat="Json"/>

        </behavior>
      </endpointBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>

    <services>
      <service name="TestingServices.TestService" behaviorConfiguration="ServiceBehaviour">
        
        <endpoint address="" binding="webHttpBinding" contract="TestingServices.ITestService" name="basichttp_service" bindingConfiguration="crossDomain" behaviorConfiguration="WebBehavior">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <serviceHostingEnvironment  multipleSiteBindingsEnabled="true" />
    <standardEndpoints>
      <webHttpEndpoint>
        <standardEndpoint crossDomainScriptAccessEnabled="true"/>
      </webHttpEndpoint>
      <webScriptEndpoint>
        <standardEndpoint crossDomainScriptAccessEnabled="true"/>
      </webScriptEndpoint>
    </standardEndpoints>
    <bindings>
      <webHttpBinding>
        <binding name="default"/>
        <binding name="crossDomain" crossDomainScriptAccessEnabled="true"/>
      </webHttpBinding>
    </bindings>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>







\\\this is my client config \








\\\this is my client config \\\\


<system.serviceModel>
   <client>
      <endpoint name="ITestService" address="http://localhost:1579/TestService.svc" binding="wsHttpBinding" contract="TestServiceReference.ITestService"/>
    </client>
</system.serviceModel>


这篇关于从IIs托管的WCF服务应用程序获取错误的地址或soap操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆