Shared Hosting Setup Guide

This guide explains how to set up .NET on shared hosting environments where you can't install software globally but can upload files.

#

📋 Method 1: Upload Pre-Downloaded .NET SDK

##

Step 1: Download .NET SDK Locally

1. Visit [.NET Download Page](https://dotnet.microsoft.com/download)

2. Download the appropriate SDK for your hosting platform:

- Linux x64: dotnet-sdk-8.0.xxx-linux-x64.tar.gz

- Linux ARM64: dotnet-sdk-8.0.xxx-linux-arm64.tar.gz

##

Step 2: Extract and Prepare SDK

Extract the downloaded SDK

tar -xzf dotnet-sdk-8.0.xxx-linux-x64.tar.gz

This creates a folder with the SDK contents

Rename it to 'dotnet-sdk' for consistency

mv dotnet-sdk-8.0.xxx-linux-x64 dotnet-sdk

##

Step 3: Upload to Your Hosting

1. Upload the dotnet-sdk folder to your project root

2. Upload your Node.js project files

3. Your hosting directory should look like:

your-project/

├── package.json

├── index.js

├── setup.js

├── run-dotnet.js

├── dotnet-sdk/

← Your uploaded .NET SDK

│ ├── dotnet

← Main executable

│ ├── sdk/

│ ├── shared/

│ └── ...

└── node_modules/

##

Step 4: Set Execute Permissions

If your hosting supports SSH access:

SSH into your hosting

ssh your-username@your-host.com

Navigate to your project

cd path/to/your/project

Set execute permission on dotnet binary

chmod +x dotnet-sdk/dotnet

Verify it works

./dotnet-sdk/dotnet --version

##

Step 5: Run Your Application

Install Node.js dependencies

npm install

Setup will automatically detect the local SDK

npm run setup

Start your application

npm start

#

📋 Method 2: Manual Environment Setup

If the automatic detection doesn't work, you can manually set environment variables:

##

In your hosting's control panel or startup script:

export DOTNET_ROOT=/path/to/your/project/dotnet-sdk

export PATH=$DOTNET_ROOT:$PATH

##

Or modify your Node.js startup:

Create a start.sh script:

#!/bin/bash

export DOTNET_ROOT="$(pwd)/dotnet-sdk"

export PATH="$DOTNET_ROOT:$PATH"

node index.js

Make it executable and run:

chmod +x start.sh

./start.sh

#

🔍 Troubleshooting

##

Permission Issues

If you get permission denied:

chmod +x dotnet-sdk/dotnet

chmod +x dotnet-sdk/sdk/8.0.xxx/dotnet

For all files in SDK (if needed):

find dotnet-sdk -type f -name "dotnet*" -exec chmod +x {} \;

##

Architecture Mismatch

If you get "cannot execute binary file":

1. Check your hosting architecture: uname -m

2. Download the correct SDK version:

- x86_64 → use linux-x64

- aarch64 → use linux-arm64

##

Path Issues

Verify the SDK is detected:

Check if dotnet is found

which dotnet

Check version

dotnet --version

Check SDK location

dotnet --info

#

🚀 Hosting-Specific Tips

##

Shared cPanel Hosting

1. Use File Manager to upload the dotnet-sdk folder

2. Use Terminal (if available) to set permissions

3. Add environment variables in .htaccess or startup scripts

##

Node.js Hosting (Heroku, Railway, etc.)

1. Include the dotnet-sdk folder in your git repository

2. Add a Procfile or startup command:

web: DOTNET_ROOT=./dotnet-sdk PATH=./dotnet-sdk:$PATH node index.js

##

VPS/Dedicated Hosting

1. Upload via SCP/SFTP: scp -r dotnet-sdk user@host:/path/to/project/

2. Set permissions via SSH

3. Update shell profile if needed

#

✅ Verification

Your setup is working if:

1. ✅ dotnet --version returns a version number

2. ✅ npm run setup completes without errors

3. ✅ The web interface shows ".NET is available"

4. ✅ The sample Web API starts successfully

#

📊 File Size Considerations

- .NET SDK is approximately 200-300MB

- Consider hosting limits on file uploads

- Some hosting providers have file count limits

- ZIP the SDK for faster upload, then extract on server

#

🔒 Security Notes

- The uploaded .NET SDK contains your application runtime

- Ensure proper file permissions (don't make everything executable)

- Consider hosting provider security policies

- Monitor resource usage (CPU/Memory) limits

---

Need help? Check the main README.md for additional troubleshooting steps!


← Back to Testing Interface