diff --git a/OnvifWebServer/Controllers/Onvif/CurdController.cs b/OnvifWebServer/Controllers/Onvif/CurdController.cs index ef8443a..44f652d 100644 --- a/OnvifWebServer/Controllers/Onvif/CurdController.cs +++ b/OnvifWebServer/Controllers/Onvif/CurdController.cs @@ -46,7 +46,7 @@ namespace OnvifWebServer.Controllers.Onvif /// /// IP地址 /// - [HttpGet] + [HttpDelete] public bool Remove( [Required][DataValidation(ValidationTypes.IPv4)] string ip) { diff --git a/OnvifWebServer/Controllers/Onvif/ImagingController.cs b/OnvifWebServer/Controllers/Onvif/ImagingController.cs index 2003763..1de5f9b 100644 --- a/OnvifWebServer/Controllers/Onvif/ImagingController.cs +++ b/OnvifWebServer/Controllers/Onvif/ImagingController.cs @@ -44,7 +44,7 @@ namespace OnvifWebServer.Controllers.Onvif /// /// /// - [HttpGet] + [HttpPost] public async Task FocusAbsoluteMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip, [Required] float position) @@ -59,7 +59,7 @@ namespace OnvifWebServer.Controllers.Onvif /// /// /// - [HttpGet] + [HttpPost] public async Task FocusRelativeMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip, [Required] float distance) @@ -74,7 +74,7 @@ namespace OnvifWebServer.Controllers.Onvif /// /// /// - [HttpGet] + [HttpPost] public async Task FocusContinuousMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip, [Required] float speed) @@ -87,7 +87,7 @@ namespace OnvifWebServer.Controllers.Onvif /// 停止变焦 /// /// IP地址 - [HttpGet] + [HttpPost] public async Task FocusStopMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip) { diff --git a/OnvifWebServer/Controllers/Onvif/PTZController.cs b/OnvifWebServer/Controllers/Onvif/PTZController.cs index fe18525..0351181 100644 --- a/OnvifWebServer/Controllers/Onvif/PTZController.cs +++ b/OnvifWebServer/Controllers/Onvif/PTZController.cs @@ -42,11 +42,11 @@ namespace OnvifWebServer.Controllers.Onvif /// 绝对移动 /// /// IP地址 - /// 水平方向移动绝对点 - /// 垂直方向移动绝对点 - /// 变焦绝对点 + /// 水平方向移动绝对点[-1,1] + /// 垂直方向移动绝对点[-1,1] + /// 变倍绝对点[-1,1] /// - [HttpGet] + [HttpPost] public async Task AbsoluteMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip, [Required] float pan, [Required] float tilt, [Required] float zoom) @@ -56,13 +56,13 @@ namespace OnvifWebServer.Controllers.Onvif } /// - /// 绝对移动 + /// 相对移动 /// /// IP地址 - /// 水平方向移动绝对点 - /// 垂直方向移动绝对点 - /// 变焦绝对点 - [HttpGet] + /// 水平方向移动相对点[-1,1] + /// 垂直方向移动相对点[-1,1] + /// 变倍相对点[-1,1] + [HttpPost] public async Task RelativeMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip, [Required] float pan, [Required] float tilt, [Required] float zoom) @@ -75,10 +75,10 @@ namespace OnvifWebServer.Controllers.Onvif /// 持续移动 /// /// IP地址 - /// 水平方向移动绝对点 - /// 垂直方向移动绝对点 - /// 变焦绝对点 - [HttpGet] + /// 水平方向移动速度[-1,1] + /// 垂直方向移动速度[-1,1] + /// 变倍移动速度[-1,1] + [HttpPost] public async Task ContinuousMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip, [Required] float pan, [Required] float tilt, [Required] float zoom) @@ -91,7 +91,7 @@ namespace OnvifWebServer.Controllers.Onvif /// 停止移动 /// /// IP地址 - [HttpGet] + [HttpPost] public async Task StopMove( [Required][DataValidation(ValidationTypes.IPv4)] string ip) { diff --git a/OnvifWebServer/Properties/launchSettings.json b/OnvifWebServer/Properties/launchSettings.json index fee36ac..4d68200 100644 --- a/OnvifWebServer/Properties/launchSettings.json +++ b/OnvifWebServer/Properties/launchSettings.json @@ -1,29 +1,29 @@ { - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:37315", - "sslPort": 44355 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "OnvifWebServer": { - "commandName": "Project", - "dotnetRunMessages": "true", - "launchBrowser": true, - "applicationUrl": "https://localhost:6001;http://localhost:6000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:37315", + "sslPort": 44355 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "OnvifWebServer": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "applicationUrl": "http://localhost:10011;http://192.168.1.119:10011", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } } \ No newline at end of file diff --git a/OnvifWebServer/Startup.cs b/OnvifWebServer/Startup.cs index d4b5827..13c5b08 100644 --- a/OnvifWebServer/Startup.cs +++ b/OnvifWebServer/Startup.cs @@ -19,6 +19,7 @@ namespace OnvifWebServer // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + services.AddCorsAccessor(); // CORS services.AddControllers().AddInject().AddUnifyResult(); // AddInject(); } @@ -30,7 +31,9 @@ namespace OnvifWebServer app.UseDeveloperExceptionPage(); } - app.UseHttpsRedirection(); + //app.UseHttpsRedirection(); + + app.UseCorsAccessor(); // CORS app.UseRouting();