Solution shared by David.Warwick on SO: To manually move the .well-known folder and file to a new directory named StaticFiles outside of wwwroot. Created a controller named WellKnown to serve the file, specifying the appropriate route and endpoint.
+The StaticFiles folder, as suggested by David, should be relocated to the wwwroot directory. Additionally, review API integration and annotations for correctness.
@Anders Bøg Holm , Glad to see that your issue is resolved and thanks for confirming the solution that worked. Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer. They can only accept answers by others, I' have summarized and posted the solution, request you to Accept the answer, it will benefit the community find the answers quickly.
Additional things to try:
-configure routing/hosting on what happens when /apple-developer-merchantid-domain-association url is invoked.
-provide right content-type to return the file content.
If backend is hosted on EJS, update as below, it would differ based on the backend technology/framework you are using (please try similar approach)
app.get('/apple-developer-merchantid-domain-association', (req, res) => {
res.setHeader('Content-Type', 'text/plain');
res.sendFile(path.resolve(__dirname, '.wellknown/apple-developer-merchantid-domain-association'));
});