Deploying ServiceStack App to IIS Subfolder under Root - iis

I have a simple ServiceStack application that I was able to host as a console app and I'm now wanting to package/deploy it for IIS.
I've created an ASP.Net application project and can successfully run the service on my local machine. When I tried to deploy it to an IIS server (v7.5) in a subfolder under root, I get a 404.
Per the examples and documentation on the ServiceStack site, I set location path web.config setting like this
<location path="api">
...
</location>
I tried these paths
/api
/subfolder_name/api
but none work.
Is it not possible to have it in a subfolder and have it the path of api?
I have it in a subfolder under the root and have the path config'd like this: . Yet it doesn't work. So does that mean that all of my files have to be under the root and then I have to alter the global.asax to include my apphost init code? Seems a little messy to me.

Not sure of your exact setup but specifying the path in AppHost.Configure() may also help:
SetConfig(new EndpointHostConfig
{
ServiceStackHandlerFactoryPath = "api",
});

Related

Laravel Deployment all routes except / show 404

TLDR
I'm deploying a Laravel application to Directadmin with deployer's recipe. Getting 404 on all routes except /.
What I've tried
Manual Deploy
Initially I created the storage link Laravel requires between app/storage/public and public/storage
ln -sfn /home/myuser/domains/example.com/laravel/storage/app/public/ /home/myuser/domains/example.com/laravel/public/storage
For security I've placed the source files outside of public_html and created symlinks for the contents of public into public_html
/home/myuser/domains/example.com/laravel/
ln -s home/myuser/domains/example.com/laravel/public/* home/myuser/domains/example.com/public_html/
This kept leading me to all sorts of crazy errors during runtime like Whitescreens and route issues even though the deployment cleared cache and routes and followed Laravel deployment steps.
Deployer Script
Switched to Deployer's Laravel recipe and symlinked the each file and folder in current to public_html so I can have subdomains on the same domain. This worked the first 2 deployments round after some coaxing with permissions.
Then had route cache issues causing a symphony closure error. Which I solved by clearing routes and restarting the httpd server.
Next deployment all routes except / show 404.
What I've done this deployment
Reset permissions
npm run prod
php artisan route:clear
php artisan cache:clear
Checked .htaccess
restart httpd
Read most questions on Stackoverflow on 404's and routes [1] [2] which suggest clearing route cache and checking order of routes and typo's in route files.
One thing to note I'm deploying code that works in Dev on Linux PHP8. So there's no issues with the routes files. Deploying to the same Linux distro and same version of PHP.
Most of these steps are part of the deployment script anyway. But somehow Laravel finds a way to break on each deployment (even when it's scripted). Laravel is so temperamental!!
Anyone have an idea what else could be wrong?
[404 Routes Question][1]
[Another 404 Routes question with htaccess][2]
[Laravel Api routes does not work][3]
[1]: https://stackoverflow.com/questions/14160202/laravel-debugging-404-routes
[2]: https://stackoverflow.com/questions/24147460/laravel-all-routes-except-return-404
[3]: https://stackoverflow.com/questions/57400525/laravel-api-routes-doesnt-works-404

Folder structure to deploy app on EC2 instance

I am setting up a new React app on EC2 instance (ubuntu). I have installed nodeJS and npm and I am able to build my app successfully.
Issue is my code is in /var/www/html folder and my site example.com is pointed to this folder.
when I run
npm run build
It builds a folder under /html like /html/build now my app runs on example.com/build. Resources for these files comes from example.com/static/style.css etc but they actually reside under example.com/build/static
I can edit asset-manifest.json and change the path but thats not appropriate solution as I need to get rid of /build folder for production
I am not super familiar with deployments to EC2 but this looks like you just need to either copy the entire contents of your app inside var/www/html, or you need to tell apache or nginx to look to the right folder (in this case /build)
For example, with apache you probably have a file inside /etc/apache2/sites-enabled/ that is pointing to /var/www/html, you could change that to /var/www/html/build and restart apache.
You can check this for examples on how to write these configurations https://gist.github.com/rambabusaravanan/578df6d2486a32c3e7dc50a4201adca4

How to host and access files on a Netlify site

I am using Netlify to host a github repo and am trying to find a way to host additional files on the domain.
( If you don't know what Netlify is check it out. It's a fast dirty and free version of AWS code deploy as far as I understand. (Disclaimer have not used AWS code deploy))
Example
Base Domain:
https://physiome-test.netlify.com/
Load a 3D model from
https://physiome-test.netlify.com/3Dmodels/heart/fullheart.json
Does anyone know if this is possible? I understand that they only provide 'static sites' but I don't see why that couldn't include file storage so that one doesn't have to worry about CORS
Netlify will host all static content in the folder you tell it to on deploy. You are currently telling Netlify to put your whole repository into the site starting at the root of the repository. This is causing issues with your relative paths.
You can go to any path in your repository at this time on your site and get a returned response of the file.
Solution:
Build your site into one build location and have Netlify deploy that location to the site. Any path relative to the root path of the location will be the root of your site.
1. Put the body assets under your simple_heart/models directory at simple_heart/models/body
2. netlify.toml (root of your repository)
[build]
command = "cp -r ./simple_heart ./build && npm run build"
publish = "build"
3. Fix your index.html in the simple_heart to reflect the relative paths from the root of simple_heart which will now be the root of your site with the build assets physiomeportal.js and physiomeportal.min.js at the root of your site.
note: To see this, run the command from the root of your site on a local build.

Deploying Angular 6 app to linux shared hosting (Apache server)

Not trying to duplicate the existing questions on "Deploying Angular apps"
I am trying to deploy an Angular 6 app to shared hosting on go daddy.
I see a blank page after i upload the files to public folder
I have tried the following troubleshooting steps
1. https://angular.io/guide/deployment#production-servers
2. https://github.com/mgechev/angular-seed/wiki/Deploying-prod-build-to-Apache-2
3. Unable to deploy Angular 5 using dist folder in WAMP server
4. I have tried changing the path on <base href="./">
5. Used the ng build --prod command to create the files in dist folder and uploaded them aas it is to the public www folder then created the .htaccess folder and rewritten rule as per angular docs
Any suggestions or help is greatly appreciated.
Thanks in advance.
Nothing seems to solve the problem.
Has anyone deployed an angular2+ app on godaddy shared linux hosting (apache server) ?
It was an issue with the routing.
I was routing using localhost as route URL.
It had nothing to do with the server setup

IIS7.5 Application is using web.config in the root directory instead of its own!

Note: I did not setup a virtual directory its a Application!
Here is the structure
Hard drive folders:
-IISRoot
-Webpage
Test.aspx
web.config
-WebService
-Bin
Service.svc
web.config
IIS is setup the following way:
-WebSite (Mapping against ISSRoot\Webpage)
-Service ((Application) mapping against IISRoot\WebService)
Now when i try to run the Service.svc i get a error that a httpHandler was not found ("Could not load type 'Jympa.Nu.FileRequestHandler'")...
Now if i look in the web.config in the root there is a line adding this but the web.config in the webservice is not..
So why is IIS using the wrong web.config?
Edit:
If i remove the web.config in the
Webpage folder the service works but
the webpage stops to work..
I found a solution i changed the pipeline mode on the application pool to Integrated.

Resources