当我浏览服务操作但是它能够浏览到扩展名为.svc的基地址时,IIS托管的wcf服务返回空白。

时间:2016-06-27 08:51:51

标签: c# wcf iis

我的IIS能够浏览到“http://localhost:50706/LoginService.svc”,但当我尝试调用wcf操作“http://localhost:50706/LoginService.svc/login?email=maiyanemokoena@gmail.com&password=123”时返回空白,这意味着返回用户使用特定电子邮件的数据。

当我在visual studio上运行wcf服务时,它可以很好地工作。

我的登录界面如下:

    [ServiceContract]
    public interface ILoginService
    {
        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "login?email{email}&password={password}", ResponseFormat =
            WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle=WebMessageBodyStyle.Bare)]
        BaseUser Login(string email, string password);
    }

这是我的web.config文件:

  <system.serviceModel>
     <!--Stuff that Thato added in order to expose more endpoints-->
    <services>

     <service name="WCF.LoginService" >
       <endpoint address="" behaviorConfiguration="webHttpBehaviour" binding="webHttpBinding"
        contract="WCF.ILoginService"></endpoint>
       <host>
         <baseAddresses>
           <add baseAddress="http://localhost:50706/LoginService.svc/"/>
         </baseAddresses>
       </host>
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"> </endpoint>
    </service>

    <!--The end of what Thato added-->  
    <behaviors>   

        <endpointBehaviors>   
        <behavior name="webHttpBehaviour">
          <webHttp/>
        </behavior>

      <behavior name="basicHttpBehaviour">
        </behavior>
      </endpointBehaviors>


      <serviceBehaviors>
          <behavior name="mexBehaviour">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
         </behavior>

        <behavior name="WCF_Behavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>

        <behavior name="">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </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>

</configuration>

请您解释一下,当我尝试访问通过提供uri模板参数访问的wcf操作时,为什么我在IIS上得到一个空白页面

0 个答案:

没有答案