当我运行示例程序时。cs(https://github.com/serilog/serilog-sinks-elasticsearch/blob/dev/sample/Serilog.Sinks.Elasticsearch.Sample/Program.cs)
我收到此错误。 请指教:-)
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Net.Http.WinHttpRequestCallback.RequestCallback(IntPtr handle, WinHttpRequestState state, UInt32 internetStatus, IntPtr statusInformation, UInt32 statusInformationLength)
at System.Net.Http.WinHttpRequestCallback.WinHttpCallback(IntPtr handle, IntPtr context, UInt32 internetStatus, IntPtr statusInformation, UInt32 statusInformationLength)
at Interop.WinHttp.WinHttpCloseHandle(IntPtr handle)
at Interop.WinHttp.SafeWinHttpHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalDispose()
at System.Net.Http.WinHttpRequestState.ClearSendRequestState()
at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
2019-10-03T10:38:57.2468492Z Failed to create the template. Elasticsearch.Net.ElasticsearchClientException: An error occurred while sending the request.. Call: Status code unknown from: HEAD /_template/serilog-events-template ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: The parameter is incorrect
at System.Net.Http.WinHttpException.ThrowExceptionUsingLastError()
at System.Net.Http.WinHttpHandler.InternalSendRequestAsync(WinHttpRequestState state)
at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()
--- End of inner exception stack trace ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
at System.Net.Http.HttpClient.<FinishSendAsyncUnbuffered>d__59.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Elasticsearch.Net.HttpConnection.Request[TResponse](RequestData requestData)
--- End of inner exception stack trace ---
at Elasticsearch.Net.Transport`1.HandleElasticsearchClientException(RequestData data, Exception clientException, IElasticsearchResponse response)
at Elasticsearch.Net.Transport`1.FinalizeResponse[TResponse](RequestData requestData, IRequestPipeline pipeline, List`1 seenExceptions, TResponse response)
at Elasticsearch.Net.Transport`1.Request[TResponse](HttpMethod method, String path, PostData data, IRequestParameters requestParameters)
at Elasticsearch.Net.Specification.IndicesApi.LowLevelIndicesNamespace.TemplateExistsForAll[TResponse](String name, IndexTemplateExistsRequestParameters requestParameters)
at Serilog.Sinks.Elasticsearch.ElasticsearchSinkState.RegisterTemplateIfNeeded() in C:\Users\john\Source\Repos\serilog-sinks-elasticsearch\src\Serilog.Sinks.Elasticsearch\Sinks\ElasticSearch\ElasticsearchSinkState.cs:line 161
[12:38:57 INF] Hello, world!
[12:38:57 DBG] Dividing 10 by 0
[12:38:57 ERR] Something went wrong
System.DivideByZeroException: Attempted to divide by zero.
at Serilog.Sinks.Elasticsearch.Sample.Program.Main(String[] args) in C:\Users\john\Source\Repos\serilog-sinks-elasticsearch\sample\Serilog.Sinks.Elasticsearch.Sample\Program.cs:line 60
[12:38:57 DBG] Reusing string by True
Press any key to continue . . .
答案 0 :(得分:2)
错误竟然没有将Prelude Control.Monad> foldN 2 ["bunny"] generation
["bunny","bunny","bunny","bunny","bunny","bunny","bunny","bunny","bunny"]
设置为类似
import Control.Monad(>=>)
manyGenerations :: Integral n => n -> [a] -> [a]
manyGenerations 0 = id
manyGenerations n = generation >=> manyGenerations (n-1)