PragmaticFlow/NBomber.Http

NBomber 3.3.0 Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0

Opened this issue · 0 comments

code:
var step = Step.Create("fetch_html_page",

           clientFactory: HttpClientFactory.Create(),
           execute: context =>
           {
               stupid += 1;
               var request = Http.CreateRequest("POST",
                   "http://127.0.0.1:9038/TestPool/GetPoolData")
                   .WithHeader("Accept", "text/plain")                   
               .WithHeader("Content-Type", "application/json")
               .WithBody(new StringContent(JsonConvert.SerializeObject(new
               {
                   dataid = DateTime.Now.Ticks.ToString(),
                   shopid = "1001",
                   branchno = "1000",
                   datatype = 1
               })));

               if (stupid > 500)
               {
                   stupid = 0;
               }

               return Http.Send(request, context);
           },
           timeout: TimeSpan.FromSeconds(10));

        var scenario = ScenarioBuilder
            .CreateScenario("simple_http", step)
            .WithWarmUpDuration(TimeSpan.FromSeconds(1))
            .WithLoadSimulations(
                Simulation.InjectPerSec(rate: 10, during: TimeSpan.FromSeconds(10))
            );

        // creates ping plugin that brings additional reporting data
        var pingPluginConfig = PingPluginConfig.CreateDefault(new[] { "nbomber.com" });
        var pingPlugin = new PingPlugin(pingPluginConfig);

        NBomberRunner
            .RegisterScenarios(scenario)
            .Run();
        Console.ReadKey();
        Console.WriteLine("Hello World!");

log:
2022-11-12 14:58:16.143 +08:00 [INF] [ThreadId:1] NBomber 3.3.0 Started a new session: 2022-11-12_06.58.02_session_b49603a8
2022-11-12 14:58:16.347 +08:00 [INF] [ThreadId:1] NBomber started as single node
2022-11-12 14:58:16.429 +08:00 [INF] [ThreadId:1] Plugins: no plugins were loaded
2022-11-12 14:58:16.430 +08:00 [INF] [ThreadId:1] Reporting sinks: no reporting sinks were loaded
2022-11-12 14:58:16.430 +08:00 [INF] [ThreadId:1] Starting init...
2022-11-12 14:58:16.466 +08:00 [INF] [ThreadId:1] Target scenarios: simple_http
2022-11-12 14:58:16.481 +08:00 [INF] [ThreadId:1] Start init client factory: [lime]nbomber_http_factory@simple_http[/], client count: [deepskyblue1]1[/]
2022-11-12 14:58:16.551 +08:00 [INF] [ThreadId:1] Init finished
2022-11-12 14:58:16.559 +08:00 [INF] [ThreadId:1] Starting warm up...
2022-11-12 14:58:16.725 +08:00 [FTL] [ThreadId:1] Step 'fetch_html_page' from Scenario: 'simple_http' has failed. Error: step unhandled exception: Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
2022-11-12 14:58:16.726 +08:00 [FTL] [ThreadId:1] Step 'fetch_html_page' from Scenario: 'simple_http' has failed. Error: step unhandled exception: Could not load file or assembly 'System.Security.Permissions, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
....
2022-11-12 14:58:30.717 +08:00 [INF] [ThreadId:7] Stopping scenarios...
2022-11-12 14:58:30.740 +08:00 [INF] [ThreadId:7] Start dispose client factory: nbomber_http_factory@simple_http
2022-11-12 14:58:30.746 +08:00 [INF] [ThreadId:7] Calculating final statistics...
2022-11-12 14:58:31.017 +08:00 [WRN] [ThreadId:4] Test finished with errors, please check the log file