Web push subscription from subdomain - service-worker

We use SaaS software without access to root directory (and without any web push service built-in). As we'd like to allow subscriptions for web push notifications.
Every web push manager service I know (like PushPushGo or Gravitec or others) requires to put JS service worker in root directory.
So I thought of calling it from subdomain delegated to other server where we have root directory access. The question is -- is there a proper way to call subscription on main domain website?
So the web push registering script / service worker is on webpush.domain.com yet the website operates on domain.com (or www.domain.com). We are still allowed to customize JavaScript on SaaS software yet the scripts are in dedicated subfolder.

Related

How does the browser work with service workers and application caching together?

At the moment, you'll need to use service workers and offline application caching to make sure every browser works with your offline website, as some browsers do not support service workers as of yet. (Edge and Safari).
My question is how do the browsers react when they use both service workers and application caching?
Does the browser use service workers over application cache if both are in use?
Or do they work side-by-side, causing possible conflicts?
If there's an existing Application Cache associated with a web page client at the time that a service worker activates, that association is dropped, and the service worker will be the only thing consulted moving forward.
That behavior is documented in the service worker specification, so it should be consistent across all browsers that support service workers:
For each service worker client client whose creation URL matches
registration’s scope url:
If client is a window client, unassociate client’s responsible
document from its application cache, if it has one.
Else if client is
a shared worker client, unassociate client’s global object from its
application cache, if it has one.
Note: Resources will now use the
service worker registration instead of the existing application cache.

Why is it not recommended to host receive endpoints in a web application using MassTransit?

I am working on an ASP.NET MVC 5 application (based on nopCommerce). I want to use MassTransit to communicate with another application that is used for inventory management, billing, etc. It would be easier if I could add receive endpoints directly into the web application and not have to create a Windows service for that. But the MassTransit documentation says it is not recommended and there is no explanation as to why that is.
MassTransit in a web application
Configuring a bus in a web site is typically done to publish events,
send commands, as well as engage in request/response conversations.
Hosting receive endpoints and persistent consumers is not recommended
(use a service as shown above).
Does anyone know the reasoning behind it? Is it not safe to add receive endpoints in a web application? Will they not work properly?
Hosting endpoints in a web application is not recommended because web applications often restart for various reasons. These reasons are typically outside the control of the application itself.
While using a standalone Windows service is highly recommended, as long as the bus is properly started and stopped using the Application_Start and Application_End methods, it can be okay if you have no other options available.

How to deploy a single multi tenant MVC application to multiple Azure virtual directories

I have a single MVC.net web project that will be deployed for multiple customers
The code base and database structure is identical for each customer however on deployment, different CSS and images are used giving each customer their own look and feel.
Each application needs to have the same root url, mydomain.com. I would like to be able to configure so that when a user navigates to mydomain.com/site1 then they are shown customer A's specific deployment of the application. I would also like these deployments to be running on separate app pools (or similar).
mydomain.com/site1
mydomain.com/site2
mydomain.com/site3
I'm currently deploying to an Azure cloud service and using SQL Azure for the database (one DB shared by each cloud service).
How can I setup the above structure using Azure cloud services and ensure that all our customers can use the same root URL but have different complete applications for all of the multiple sites?
Can this be done using virtual directories on an Azure cloud service?
If not, what would be the best way of achieving this?

How to publish and host a MVC4 application in your domain?

I have a webdomain www.MyDomain.com and a MVC4 web application MyMVCWebApp.
First I publish the application to a local destination.
For instance: C:\TempLocation
And then I host it to my domain with a FTP-tool (FileZilla??)
The files will be hosted but I can't find the webpage.
Which url do I have to write?
http://www.MyDomain.com/MyMVCWebApp/Home/Index.chtml or something?!
Do I have change the settings in my web.config?
What do I have to do?
You can't host an application on a domain.
An application is hosted on a web server. A domain name is only a way to translate an easy to remember address like "www.google.com" to the web server ip address which looks like 173.194.66.104
It is possible to purchase a domain without a web server.
So before going further:
Check if you actually bought a domain only, or a domain with a server
Your domain should redirect to your server ip address, you can see if he is correctly configured by opening a command prompt and doing
C:\> ping www.yourdomain.com
If this is not the case you will need to update the A record of your domain, and wait for the update to be replicated on DNS server worldwird.
If you have a managed server, you should check your hosting provider website. They usually provide in depth documentation, and they all have a different way to do things. Most of the time indeed you will be able to upload your files using a FTP software such as Filezilla.
However, in order to host a MVC 4 application you need a server with
the IIS web server, which means that you need a Windows server. So if
you have a Linux server, you should contact your hosting provider
support and tell them you made a mistake during your order. (It is
possible to host a MVC 4 application on Linux, but I don't think it
is often provided on managed servers)
If you have a dedicated server you are on your own.
The URL you will have to write to access your application will depends on what you have configured in the RegisterRoutes method of the RouteConfigs.cs file.
I recommend you to watch the last video on this page to have a better overview of the possibilities.

Can I store a clients website within my website

I'm working on a clients pre-existing web site. I would like to take the solution they sent me and host it within my web site so that I can make changes to it and the client can see them without modifying their current live version without their approval.
It would be nice to store on a sub domain. How do I contain the web site within a folder so that it doesn't conflict with my web.config and other files?
All you are talking about is taking their files and hosting them on a domain of your choice ... this is generally deemed a Dev Site. Nothing fancy here, just create a IIS directory or application for the client's version of software on your server machine and map your domain to it via DNS settings.
Here is an article on creating sub domains
http://forums.asp.net/t/874598.aspx

Resources