Prerequisites
- Active SmarterASP.NET or Site4now.net hosting account
- SQL Server database provisioned
- FTP or Web Deploy credentials from your hosting panel
- .NET 8.0 SDK installed locally
Deployment Methods
SmarterASP.NET supports multiple deployment methods:- Web Deploy (MS Deploy) - Recommended, fastest method
- FTP Upload - Manual upload via FTP client
- GitHub Actions CI/CD - Automated deployment (see CI/CD guide)
Method 1: Web Deploy (Recommended)
Step 1: Configure Publish Profile
The project includes a pre-configured Web Deploy profile at:Step 2: Publish via Visual Studio
- Right-click the
Webproject in Solution Explorer - Select Publish…
- Choose Site4now-WebDeploy profile
- Enter your password when prompted
- Click Publish
Step 3: Publish via CLI
Method 2: FTP Upload
Step 1: Publish Application Locally
Publish the application to a local folder:./publish directory.
Step 2: Connect via FTP
Use an FTP client (FileZilla, WinSCP, etc.) with your hosting credentials:- Host: Your FTP server (e.g.,
win8145.site4now.net) - Port: 21
- Username: Your hosting username
- Password: Your hosting password
- Protocol: FTP or FTPS
- Transfer Mode: Passive (recommended)
Step 3: Upload Files
- Navigate to your site’s root directory (e.g.,
/sistemafinancieroor/wwwroot) - Delete existing files in the directory to avoid conflicts
- Upload all contents from
./publishfolder - Ensure
web.configis uploaded correctly - Wait for upload to complete (may take 5-10 minutes)
Step 4: Set Folder Permissions
Ensure the following folders have write permissions:App_Data(if exists)- Any folders for file uploads or logs
SQL Server Configuration
Step 1: Get Database Connection String
From your SmarterASP.NET control panel:- Navigate to SQL Server Databases
- Note your database details:
- Server name
- Database name
- Username
- Password
Step 2: Configure Production Settings
Updateappsettings.Production.json before publishing:
Step 3: Apply Database Migrations
Option A: Generate SQL Script
-
Generate migration script locally:
-
Execute via SQL Management Studio:
- Download SQL Server Management Studio (SSMS) or Azure Data Studio
- Connect to your SmarterASP.NET SQL Server
- Open
migration.sqland execute
Option B: Use SmarterASP Control Panel
- Go to SQL Server section in control panel
- Open Query Analyzer or SQL Web Admin
- Paste and execute the migration script
Option C: Remote Connection (if enabled)
If remote connections are enabled:Production Settings Review
Security Configuration
Ensure the following security settings are properly configured:- JWT Key: Use a strong, unique key (minimum 32 characters)
- CORS: Configure allowed origins if needed
- HTTPS: Enable SSL certificate in hosting panel
- Connection Strings: Never commit production credentials
Performance Optimization
- Logging Level: Set to
WarningorErrorin production - Response Compression: Enabled by default in ASP.NET Core
- Static File Caching: Configured automatically
- Database Connection Pooling: Enabled by default in EF Core
Verification Steps
After deployment, verify the application is working correctly:1. Check Health Endpoint
Access:https://yourdomain.com/health
Expected response:
2. Access Swagger UI
Access:https://yourdomain.com/swagger
You should see the API documentation. Consider disabling Swagger in production:
3. Test API Endpoints
Test a simple endpoint to verify database connectivity:4. Test Authentication
If using JWT authentication, test token generation and validation.5. Review Logs
Check application logs in your hosting panel:- Navigate to Log Files section
- Review
stdout.logand error logs - Look for any startup errors or connection issues
Troubleshooting
Application Won’t Start
- Check
stdout.login hosting panel - Verify .NET 8.0 runtime is enabled in control panel
- Ensure
web.configis present and correct - Verify connection string is valid
Database Connection Errors
- Verify SQL Server credentials
- Check firewall rules (if using remote connections)
- Add
TrustServerCertificate=trueto connection string - Ensure database exists and migrations are applied
500 Internal Server Error
- Enable detailed errors temporarily:
- Review logs for stack traces
- Verify all required dependencies are published
FTP Upload Issues
- Use Passive Mode in FTP client
- Delete old files before uploading new ones
- Verify folder permissions
- Ensure
web.configis uploaded correctly
Updating the Application
To deploy updates:- Set
DeleteExistingFilestoTruein publish profile - Publish using Web Deploy or FTP
- The application pool restarts automatically
- Verify deployment with health check endpoint
app_offline.htm.
Next Steps
- Set up CI/CD automation for streamlined deployments
- Configure custom domain and SSL certificate
- Set up monitoring and alerting
- Implement backup strategy for database