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
執行控制檯webjob但在當地是成功的工作運行該應用程序時,我收到以下錯誤。
這裏是我的代碼
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;
}
與實體類是如下
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
實體值如下
average - 244.1
count - 3
date - 2017-12-27 10:15:26
inputid - 36-i1
max-244.1
min - 244.0
和實體類是如下
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; }
}
任何解決方案來解決這個問題?
「錯誤格式化rowDate查詢語法「。您的輸入在本地和服務器之間必須不同。 – Crowcoder
如果我在本地和服務器上使用相同資源,會發生什麼情況? –
我建議你調試它。你在使用VS 2017嗎?如果是這樣得到最新的更新和[看到這個](https://www.visualstudio.com/vs/debug-in-azure/) – Crowcoder