Неверный запрос с конечной точкой SOAP Веб-сервис WCF - PullRequest
1 голос
/ 05 октября 2011

У меня есть служба WCF, которая должна иметь несколько конечных точек (в частности, json и SOAP), чтобы сделать ее совместимой с устройствами Android и WP7.

При наличии конфигурации, представленной в следующем файле, я могу получить доступ кс Google Chrome, используя конечную точку json, но если я попытаюсь использовать конечную точку мыла, я не смогу.Используя Fiddler, я получил ошибку 404 для адреса http://liveandesor.web711.discountasp.net/wcf/SightingServiceRest.svc/json,, в то время как я получил ошибочный запрос 400 ошибок, используя те же адреса, но с мылом в конце.

Я попытался использовать конфигурацию, указанную этот урок , но безрезультатно.

Почему я здесь не так?Как я могу это исправить?

Любая помощь будет принята с благодарностью.Спасибо за ваше время!: D

Вот файл web.config, который я использую:

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <!--Deploy-->

    <add name="LiveAndesWCF" connectionString="data source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_832326_liveandes;User ID=SQL2008_832326_liveandes_user;Password=******; MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>
    <add name="LiveAndes" connectionString="data source=tcp:sql2k802.discountasp.net;Initial Catalog=SQL2008_832326_liveandes;User ID=SQL2008_832326_liveandes_user;Password=****; MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>

  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
    <membership>
      <providers>
        <clear/>
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LiveAndes" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
      </providers>
    </membership>
  </system.web>
  <appSettings>
    <!-- Deploy -->

    <add key="mainPathDeployWCF" value="http://liveandesor.web711.discountasp.net/"/>
    <add key="mainMachPathDeployWCF" value="e:\web\liveandesor\htdocs"/>
    <add key="serverPath" value="e:\\web\\liveandesor\\htdocs"/>
    <add key="imageBaseUrl" value="http://liveandesor.web711.discountasp.net/Content/UploadedImages/"/>

    <!--<add key="mainMachPath" value="C:\Users\Rul\Documents\Universidad\2011'1\Taller de Especialidad\svn\Desarrollo\WEB\LiveAndesMVC\LiveAndesMVC"/>-->
  </appSettings>

  <system.serviceModel>
    <protocolMapping>
      <add scheme="http" binding="wsHttpBinding" />
    </protocolMapping>


    <services>
      <service name="LiveAndesWCF.SightingService">
        <endpoint address="soap"
                  bindingConfiguration="soapBinding"
                  binding="basicHttpBinding"
                  contract="LiveAndesWCF.ISightingService"/>
        <endpoint address="json"
                  binding="webHttpBinding" 
                  behaviorConfiguration="jsonBehavior"
                  contract="LiveAndesWCF.ISightingService"/>
      </service>
      <service name="LiveAndesWCF.UserService">
        <endpoint address="soap"
                  bindingConfiguration="soapBinding"
                  binding="basicHttpBinding"
                  contract="LiveAndesWCF.IUserService"/>
        <endpoint address="json" 
                  binding="webHttpBinding" 
                  behaviorConfiguration="jsonBehavior" 
                  contract="LiveAndesWCF.IUserService"/>
      </service>
      <service name="LiveAndesWCF.UserServiceRest" behaviorConfiguration="MetadataBehavior">
        <endpoint address="json" 
                  behaviorConfiguration="WebBehavior" 
                  binding="webHttpBinding" 
                  contract="LiveAndesWCF.IUserServiceRest"/>
      </service>
      <service name="LiveAndesWCF.SightingServiceRest" behaviorConfiguration="MetadataBehavior">
        <endpoint address="soap" 
                  binding="basicHttpBinding"
                  bindingConfiguration="soapBinding"
                  contract="LiveAndesWCF.ISightingServiceRest"/>
        <endpoint address="json" 
                  behaviorConfiguration="WebBehavior" 
                  binding="webHttpBinding" 
                  contract="LiveAndesWCF.ISightingServiceRest"/>
      </service>
      <service name="LiveAndesWCF.TestService">
        <endpoint address="soap" 
                  binding="basicHttpBinding"
                  bindingConfiguration="soapBinding"
                  contract="LiveAndesWCF.ITestService"/>
        <endpoint address="json" 
                  binding="webHttpBinding" 
                  behaviorConfiguration="jsonBehavior" 
                  contract="LiveAndesWCF.ITestService"/>
      </service>
    </services>


    <bindings>
      <basicHttpBinding>
        <binding name="soapBinding" maxReceivedMessageSize="99999999" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00">
          <readerQuotas maxArrayLength="76384000" maxStringContentLength="2147483647"/>
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
      <webHttpBinding>
        <binding maxReceivedMessageSize="99999999" closeTimeout="00:02:00" openTimeout="00:02:00" receiveTimeout="00:10:00" sendTimeout="00:02:00">
          <readerQuotas maxArrayLength="76384000" maxStringContentLength="2147483647"/>
        </binding>
      </webHttpBinding>
    </bindings>


    <behaviors>
      <endpointBehaviors>
        <behavior name="jsonBehavior">
          <enableWebScript/>
          <!--<webHttp/>-->
        </behavior>
        <behavior name="WebBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>



      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above 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="true"/>
        </behavior>
        <behavior name="MetadataBehavior">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

1 Ответ

1 голос
/ 05 октября 2011

Вы можете либо ответить на этот вопрос самостоятельно, а затем пометить его как ответ или отметить его.

"Потому что, когда я пытаюсь использовать инструмент slsvcutil для создания ссылки только с конечной точкой json, все, что он говорит«Нет конечных точек, совместимых с Silverlight 3.»

См. этот вопрос, чтобы узнать, о чем я говорю: Неверный запрос RestSharp Windows Phone 7

...