REST Webservice does not return XML in IIS 8.0

3

The webservice in visual studio 2013 works beautifully. I added it to windows 8.1's IIS, and when it comes time to send the data via REST, it gives me this error:

  

The server encountered an error while processing the request. See the service help page to build valid requests for the service.

Method: GET

WebConfig:

<?xml version="1.0"?>
<configuration>

  <connectionStrings>
    <add name="BD_Super_V8ConnectionString" connectionString="Data Source=NUNO-PC\SQLEXPRESS;Initial Catalog=BD_Super_V8;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <compilation targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <!-- REST -->
    <services>
      <service name="WcfServicePedido_v7.ServicePedido">
        <endpoint name="RestEndPoint"
                  contract="WcfServicePedido_v7.IServicePedido"
                  binding="webHttpBinding"
                  address=""
                  behaviorConfiguration="restBehavior" />
      </service>
    </services>
    <behaviors>
      <endpointBehaviors>
        <behavior name="restBehavior">
          <webHttp helpEnabled="true"/>
        </behavior>
      </endpointBehaviors>
      <!-- REST -->
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value 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>
    </behaviors>
    <serviceHostingEnvironment 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>

Service:     [ServiceContract]

public interface IServicePedido
{
    /// <summary>
    /// Retorna todos os pedidos (JSON)
    /// </summary>
    /// <returns></returns>
    [WebGet(UriTemplate = "maquinas/?volta={volta}",
        RequestFormat = WebMessageFormat.Xml,
        ResponseFormat = WebMessageFormat.Xml)]
    [OperationContract]
    List<VoltaPDA> GetAllMaquinasVolta(int volta);
}

I deleted and reissued the WebService: Now give me this error:

  

The server encountered an error processing the request. Please see the   service help page for constructing valid requests to the service.

     

LOG FILE:

2014-03-07 10:53:43 ::1 GET /ServicePedido.svc/help - 8095 - ::1
 Mozilla/5.0+(Windows+NT+6.3;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/33.0.1750.146+Safari/537.36
 http://localhost:8095/ServicePedido.svc/maquinas/?volta=1 200 0 0 24
    
asked by anonymous 06.03.2014 / 20:19

3 answers

1

Apparently your WCF runs and the error occurs at runtime. The first step is to try to change the error message to something more specific and thus be able to locate the problem. Make sure you have the debug enabled in the .svc file

<%@ ServiceHost Language="C#" Debug="true" ... %>

Then in the .config file change this option to true

<serviceDebug includeExceptionDetailInFaults="true" />

It may still be necessary to enable wcf tracing to go deeper, here is an article that helps with this: link

Try the following as well:

  • In IIS in Application Pools
  • Select the one your WCF is using
  • Click the right button and go to Advanced Settings
  • Identity, change to NetworkService
07.03.2014 / 12:43
0
  

The server encountered an error while processing the request. See page   service to build valid orders for the service. THE   exception message is 'Can not open database' BD_Super_V8 "requested by   the login The login failed. Login failed for user 'IIS   APPPOOL \ WebService '.'. Refer to the server logs for   more details. The exception stack trace is:

     

at System.Data.SqlClient.SqlInternalConnection.OnError (SqlException   exception, Boolean breakConnection, Action 1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource 1 retry, DbConnectionOptions   userOptions, DbConnectionInternal & connection at   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection (DbConnection   owningConnection, TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource 1 retry, DbConnectionOptions userOptions) at   System.Data.SqlClient.SqlConnection.TryOpenInner (TaskCompletionSource 1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource 1   retry) at System.Data.SqlClient.SqlConnection.Open () at   System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection (IConnectionUser   user) at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe () at   System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode () at   System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute (Expression   query) at   System.Data.Linq.DataQuery 1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Collections.Generic.List 1..ctor (IEnumerable 1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable 1 source) at   SyncInvokeGetAllMachinesVolta (Object, Object [], Object []) at   System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke (Object   instance, Object [] inputs, Object [] & outputs) at   System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin (MessageRpc &   rpc) at   System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5 (MessageRpc &   rpc) at   System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31 (MessageRpc &   rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process (Boolean   isOperationContextSet)

This error was returned thanks to your Iuristona help, but still does not understand why can not login to the database, when in visual studio works beautifully. Do you have permissions?

    
07.03.2014 / 13:23
0

I'm new to this webServer business but from what I've seen, your method gets an argument as a parameter. I do not know if I'm talking bullshit but from what I understood when I was studying this can only be done via Post and the as you mentioned it it sends via Get. And in fact conceptually this is the safest way.

    
08.01.2015 / 15:15