Tag: API

interfaces

set up ASP.NET API IIS path.

  • Add Website and created folder eg . c:\iis\myapi
  • Change Application Pool to No Managed Code
  • Check Security of Folder, add
    • IIS_IUSRS
    • IIS AppPool\myapi
  • Browse Created Website (should result in HTTP Error 403.14 - Forbidden to list contents cause nothing is in)
  • Create new repo eg github
  • Create new VisualStudio ASP.NET Core API
  • Run and Debug
  • try api endpoints
  • publish to target Folder (best case: separate folder to copy after publish)
  • Copy contents (using TeraCopy eg , resp. diff sync tool)
  • try sampleendpoint
    • take care that Swagger is not configured to show in default so dont despair
  • commit your state if working
  • checking git status is everything is correctly tracked.
  • rename WeatherForecast to dream name best with eg. Notepad++ replace all and change files names in VS later on.
  • test run and debug
  • publish again
  • test it on local IIS.

works till here. so integrate biz logic and repeat small steps cycle step by step.

sources of error investigation:

https://stackify.com/beyond-iis-logs-find-failed-iis-asp-net-requests/

custom err exc handling

API functional, but problems showing swagger site. steps:

  • had to check security of the COM object:

https://stackoverflow.com/questions/27937375/retrieving-the-com-class-factory-for-component-with-clsid-failed-due-to-the-foll

due to Event Viewer error desc

Category: Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
EventId: 2
SpanId: cb7174b3e1054a29
TraceId: 789b2e9b100bdb4d3fe6ed8e154135f1
ParentId: 0000000000000000
RequestId: 80000006-0007-ff00-b63f-84710c7967bb
RequestPath: /Keo/CreateKeoObj

Connection ID "18374686511347007489", Request ID "80000006-0007-ff00-b63f-84710c7967bb": An unhandled exception was thrown by the application.

Exception: 
System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {82EAAE85-00A5-4FE1-8BA7-8DBBACCC6BEA} failed due to the following error: 80070005 Access is denied. (0x80070005 (E_ACCESSDENIED)).
   at System.RuntimeTypeHandle.AllocateComObject(Void* pClassFactory)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
   at System.Activator.CreateInstance(Type type)
   at KeoCoreApi.KeoObj.CreateKeoInstance() in C:\git\keolabs\KeoCoreApi\KeoObj.cs:line 18
   at lambda_method4(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

Next steps if resolved: test from different computer, intranet:

  • connect to ip host and port
  • if connection is not working through, check firewall rules.
  • go to advanced settings
  • open up required port by adding Inbout Rule Port
  • test api from network computer
  • add /swagger , respectively the desired endpoint to url

.

Uncategorized

share IIS site o API on local intranet win10 11

https://docs.microsoft.com/en-us/iis/get-started/getting-started-with-iis/create-a-web-site

https://superuser.com/a/263893/237029

open firewall ports for spec site cause only port 80 default website is open std.

https://manage.accuwebhosting.com/knowledgebase/2886/How-to-Configure-IIS-to-Access-Your-Website-using-an-IP-Address.html

always start first with an easy landing page and add api or biz domain functions later on. step by step, eliminate possible error sources..

Uncategorized

semi dependant API calls sequence in REST realm

https://www.quora.com/What-does-state-mean-in-Representational-State-Transfer-REST

The fundamental explanation is:

No client session state on the server.

but this time we introduce builder.Services.AddSingleton<XObj>();

from my observation, I put activated the Init function after tearing cause the PICC time out occured afterwards. Tcl: //ERROR (code 5): PICC response timed out.

Tcl transmissions worked again after init protocols

err = TransmitTearing(txBuffer, out rxBuffer);
initResult = SendActivationHttpRequest().GetAwaiter().GetResult();