EOS-WebAPI/README.md
2025-09-16 16:49:49 +00:00

116 lines
3.4 KiB
Markdown

# README — **EOSWebAPI** (.NET Web API Project)
This README provides setup and configuration details for the **EOSWebAPI** project. The application is an ASP.NET Web API project backed by PostgreSQL databases, using Entity Framework and DotNetOpenAuth for authentication support.
---
## Table of contents
1. Overview
2. Prerequisites
3. Project structure
4. Configuration (`Web.config`)
5. Database setup
6. Build & run instructions
7. Deployment notes
8. Troubleshooting
9. Contact / maintainers
---
# 1. Overview
**EOSWebAPI** is a Web API project designed to expose services for the EOS platform.
It includes:
- **ASP.NET Web API** backend.
- **Entity Framework 6** ORM.
- **PostgreSQL databases** (`eos`, `eos_tracking`, etc.).
- **OAuth/OpenID support** (DotNetOpenAuth).
---
# 2. Prerequisites
- **.NET Framework 4.6+** (Web.config targets ASP.NET Web API).
- **Visual Studio** (2019 or later recommended).
- **PostgreSQL** (v12 or higher).
- **NuGet packages**: EntityFramework, Npgsql (PostgreSQL driver), DotNetOpenAuth.
---
# 3. Project structure
Typical key folders:
- `Controllers/` → API endpoints.
- `Models/` → Entity Framework models.
- `App_Start/` → Route config, filters, dependency injection.
- `Web.config` → Core configuration file (DB connections, EF, authentication).
---
# 4. Configuration (`Web.config`)
### Connection Strings
Defined in `<connectionStrings>`:
- **Production (default active)**
```xml
<add name="Vecv_Tracking" connectionString="Server=127.0.0.1;Port=5432;User Id=;Password=;Database=eos_secound_release_tracking_uat;" />
<add name="Vecv_GoData" connectionString="Server=127.0.0.1;Port=5432;User Id=;Password=;Database=eos;CommandTimeout=2000;" />
```
- **QA / UAT** (commented out for switching)
> ⚠️ Replace `User Id` and `Password` with actual credentials before deployment.
### Entity Framework
Configured for EF6 via `<entityFramework>` section.
Used to manage migrations and database interactions with PostgreSQL.
### DotNetOpenAuth
Sections included for:
- OAuth
- OpenID
- Messaging & reporting
---
# 5. Database setup
1. Install PostgreSQL (v12+).
2. Create required databases:
- `eos` (main data).
- `eos_tracking` (tracking data).
3. Apply schema SQL scripts (see EOS database README).
4. Update `Web.config` connection strings with correct credentials.
---
# 6. Build & run instructions
1. Open `EOSWebAPI.sln` in Visual Studio.
2. Restore NuGet packages.
3. Build solution (`Ctrl+Shift+B`).
4. Run with IIS Express or configure IIS for hosting.
5. API should be accessible at:
```
https://localhost:xxxx/api/{controller}/{action}
```
---
# 7. Deployment notes
- Deploy to IIS / Windows Server.
- Ensure correct environment connection strings are **uncommented** in `Web.config`.
- Use `web.config transforms` (`Web.Release.config`, `Web.Debug.config`) for automated switching between environments.
- Configure logging (Serilog/NLog recommended).
---
# 8. Troubleshooting
- **Login/auth issues** → check DotNetOpenAuth sections & OAuth client setup.
- **DB connection errors** → validate `Server`, `Port`, `Database`, `User Id`, `Password`.
- **Timeouts** → adjust `CommandTimeout` in connection strings.
- **Entity Framework migrations** → run:
```powershell
Update-Database -Verbose
```
---
# 9. Contact / maintainers
- Maintainer: (team/person name, email)
- Project: **EOSWebAPI**