The following forum(s) are migrating to a new home on Microsoft Q&A (Preview): Azure App Service - Web Apps!

Ask new questions on Microsoft Q&A (Preview).
Interact with existing posts until December 13, 2019, after which content will be closed to all new and existing posts.

Learn More

Continuous Web Job - System.NotSupportedException (Unsupported invocation type '') RRS feed

  • Question

  • Hi All,

    I'm having a bizarre issue whereby my web job continues to fail at intermittent intervals.

    Just to give a brief overview of the current process, my web job is tied to a queue trigger from which a custom object is obtained:

    public async Task ProcessClientUsageQueueMessage(
    			[QueueTrigger("clientusageupdated")] ClientUsage clientUsageMessage,
    			TextWriter log)
    			log.WriteLine("Message received: {0}", JsonConvert.SerializeObject(clientUsageMessage));
    			var clientReference = clientUsageMessage.ClientReference;
    			await ProcessClientUsage(clientReference, log);

    ProcessClientUsage then goes on to query data from an on-premises SQL server via a hybrid connection. The stored procedure unfortunately has to sift through large amounts of data resulting in this call sometimes taking around 10 minutes to complete.

    public async Task<IEnumerable<ClientUsageDetail>> GetClientUsage(Client client)
    			using (SqlConnection connection = new SqlConnection(client.ClientDatabaseConnectionString))
    			using (SqlCommand command = new SqlCommand { CommandText = "[Oracle].[_GetUsage]", Connection = connection, CommandType = System.Data.CommandType.StoredProcedure, CommandTimeout = 2000 })
    				command.Parameters.Add(new SqlParameter { ParameterName = "@KeepForDays", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Input, Value = client.DaysRetention ?? 40 });
    				command.Parameters.Add(new SqlParameter { ParameterName = "@LatestEventDetailID", SqlDbType = SqlDbType.BigInt, Direction = ParameterDirection.Input, Value = client.LatestEventDetailId ?? 0 });
    				using (SqlDataReader reader = await command.ExecuteReaderAsync())
    					var results = await reader.ReadAsIEnumarableAsync<ClientUsageDetail>();
    					_log.Debug("ClientUsageRepository.GetClientUsage: Client: {0}, results: {1}", client.Reference, results.Count());
    					return results;

    However while the web job is making the call (and occasionally when re-starting the web job), the following exception is thrown and the web job dies / restarts:

    System.NotSupportedException was unhandled
    Message: An unhandled exception of type 'System.NotSupportedException' occurred in Microsoft.Azure.WebJobs.Host.dll
    Additional information: Unsupported invocation type ''.

    This happens both locally when debugging the web job as well as on azure where the web job is hosted on a site with a standard service plan with 'Always On' set to true.

    Is this due to some timeout that is occurring within the continuous web job, or perhaps an issue with an incoming queue message? I've tried re-creating the queue and manually posting a single message, but I noticed that after a couple of minutes the web job responds to another message (which I didn't create).

    Any help would be greatly appreciated!

    Wednesday, June 29, 2016 7:56 AM

All replies

  • Hi Brett,

    If you check the WebJobs Dashboard and inspect the incoming messages list, do you see anything out of normal? (ie.: empty message(s))

    Which version of the SDK are you using?

    Best Regards,
    Carlos Sardo

    Wednesday, June 29, 2016 1:54 PM
  • As Carlos asked, please share with us the version of the WebJobs SDK you're using.

    That specific error message "Unsupported invocation type ''" is thrown when a message shows up in the WebJobs control queue used for communication between the Dashboard and the JobHost. It is a queue we create and manage. For example, when you run/rerun a job manually from the Dashboard, the dashboard puts a message into this queue, and the JobHost picks it up. So this error message implies that an invalid message is being added to this control queue - one not in the format we expect. Might it be the case that you accidentally added a message to that queue yourself? The queue will have a name like azure-webjobs-host-<guid>.

    Mathew Charles [MSFT]

    Wednesday, June 29, 2016 5:26 PM
  • Hi,

    I believe it may have actually been an issue with my framework setup at the time.

    Since having recreated the project with the latest nuget package versions everything seems to be working as expected.

    Thanks for your help!

    Monday, July 18, 2016 11:14 AM