点击功能但没有获得返回值

时间:2015-08-11 06:26:12

标签: c# asp.net wcf postman

我为我目前正在使用DevExtreme的应用程序创建了一个简单的WCF服务。

为了测试我的服务,我使用了Google Play商店提供的Postman。

服务器启动正常。如果我调试我的函数GetLogins()我可以看到Postman调用此函数,但我没有收到返回值。

IService.cs:

[ServiceContract]
public interface IService
{
    [OperationContract]
    [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "/logins")]
    List<Login> GetLogins();
}

Service.cs:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service : IService
{
    //Returns all Logins
    public List<Login> GetLogins()
    {
        var list = DAO.Instance.Login.ToList();
        return list;
    }
}

App.config中:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
  <service name="HourRegistrationWCF.Service">
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8733/Design_Time_Addresses/HourRegistrationWCF/Service/" />
      </baseAddresses>
    </host>
    <!-- Service Endpoints -->
    <!-- Unless fully qualified, address is relative to base address supplied above -->
    <endpoint address=""
              binding="webHttpBinding"
              contract="HourRegistrationWCF.IService"
              behaviorConfiguration="REST">
      <!-- 
          Upon deployment, the following identity element should be removed or replaced to reflect the 
          identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
          automatically.
      -->
      <identity>
        <dns value="localhost" />
      </identity>
    </endpoint>
    <!-- Metadata Endpoints -->
    <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
    <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="REST">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, 
      set the values below to false before deployment -->
      <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>
</behaviors>
<bindings>
  <webHttpBinding>
    <binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true"/>
  </webHttpBinding>
</bindings>

我似乎无法找到问题所在。

邮差回复

enter image description here

0 个答案:

没有答案