I am getting the following error when executing a console webjob in azure
Microsoft.WindowsAzure.Storage.StorageException: The remote server returned an error: (400) Bad Request. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.
at System.Net.HttpWebRequest.GetResponse()
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T]
(RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 677
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T]
(RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 604
at
Microsoft.WindowsAzure.Storage.Table.TableOperation.Execute(CloudTableClient client, CloudTable table, TableRequestOptions requestOptions, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Table\TableOperation.cs:line 44
at Microsoft.WindowsAzure.Storage.Table.CloudTable.Execute(TableOperation operation, TableRequestOptions requestOptions, OperationContext operationContext) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Table\CloudTable.cs:line 52
at pAvg15MinInstantInputWebJob.Avg15MinInstantInputJob.AverageCalculator(DateTime runningDate) in F:\Projects\LogiProjects\ProcessEye\Source\Kent.ProcessEye\pAvg15MinInstantInputWebJob\Avg15MinInstantInputJob.cs:line 246
Request Information
RequestID:855533de-0002-0066-2819-7f27ee000000
RequestDate:Wed, 27 Dec 2017 13:51:21 GMT
StatusMessage:Bad Request
ErrorCode:InvalidInput
ErrorMessage:Bad Request - Error in query syntax.
RequestId:855533de-0002-0066-2819-7f27ee000000
Time:2017-12-27T13:51:22.1788418Z
But running this application in locally it is working successfully.
Here is my codes
string connectionString1 = ConfigurationManager.ConnectionStrings["AzureWebJobsDashboard"].ConnectionString;
CloudStorageAccount account1 = CloudStorageAccount.Parse(connectionString1);
CloudTableClient client1 = account1.CreateCloudTableClient();
CloudTable table2 = client1.GetTableReference(pAvg15MinInstantInput);
var row = new pAvg15MinInstantInputEntity();
row.PartitionKey = targetPartitionKey;
row.RowKey = rowDate.ToString();
row.avg = entity.average;
row.count = entity.count;
row.date = rowDate;
row.inputid = entity.inputid;
row.max = entity.max;
row.min = entity.min;
try
{
TableOperation insertOperation = TableOperation.InsertOrReplace(row);
table2.Execute(insertOperation);
}
catch (Exception ex)
{
Errorlogger(runningDate, "else ----->" + ex.ToString());
return false;
}
And the Entity class is as follows
public class pAvg15MinInstantInputEntity : TableEntity
{
public DateTime? date { get; set; }
public string inputid { get; set; }
public double? min { get; set; }
public double? max { get; set; }
public double? avg { get; set; }
public long? count { get; set; }
}
UPDATE
The entity values are as follows
average - 244.1
count - 3
date - 2017-12-27 10:15:26
inputid - 36-i1
max-244.1
min - 244.0
and the entity class is as follows
public class ResultModel
{
public string inputid { get; set; }
//public long hour { get; set; }
//public long minute { get; set; }
public double max { get; set; }
public double min { get; set; }
public DateTime date { get; set; }
public double average { get; set; }
public long count { get; set; }
}
Any solution to resolve this?