wanshenmean
2026-03-13 a2b55742c64f4b2c9e6bd85ed3733adccdec48de
Code/WCS/WIDESEAWCS_S7Simulator/WIDESEAWCS_S7Simulator.Web/Pages/Create.cshtml.cs
@@ -12,13 +12,12 @@
public class CreateModel : PageModel
{
    private readonly ILogger<CreateModel> _logger;
    private readonly HttpClient _httpClient;
    private readonly IHttpClientFactory _httpClientFactory;
    public CreateModel(ILogger<CreateModel> logger, IHttpClientFactory httpClientFactory)
    {
        _logger = logger;
        _httpClient = httpClientFactory.CreateClient();
        _httpClient.BaseAddress = new Uri($"{Request.Scheme}://{Request.Host}");
        _httpClientFactory = httpClientFactory;
    }
    [BindProperty]
@@ -38,6 +37,10 @@
        try
        {
            // 创建HttpClient并设置BaseAddress
            var httpClient = _httpClientFactory.CreateClient();
            httpClient.BaseAddress = new Uri($"{Request.Scheme}://{Request.Host}");
            var config = new InstanceConfig
            {
                Id = Input.Id,
@@ -58,7 +61,7 @@
                }
            };
            var response = await _httpClient.PostAsJsonAsync("/api/SimulatorInstances", config);
            var response = await httpClient.PostAsJsonAsync("/api/SimulatorInstances", config);
            if (response.IsSuccessStatusCode)
            {