他の回答で述べたように、問題はIISがでパスを処理する方法です。それらの中に。
が、私はそうのように登録されたIHTTPハンドラを記述することによってASP.NET MVCでこの問題を解決:
これと同様に処理されていました
<system.webServer>
<handlers>
<add name="ApplePayMerchantIdDomainAssociation" path=".well-known/apple-developer-merchantid-domain-association" verb="GET" type="MyNamespace.ApplePayMerchantIdDomainAssociationHandler, MyAssembly" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
:
System.Globalizationを使用して、 using System.Web; using System.Web.Mvc;
namespace MyNamespace
{
public class ApplePayMerchantIdDomainAssociation : IHttpHandler
{
public bool IsReusable => true;
public void ProcessRequest(HttpContext context)
{
var wrapper = new HttpContextWrapper(context);
ProcessRequest(wrapper);
}
public void ProcessRequest(HttpContextBase context)
{
var type = GetType();
var assembly = type.Assembly;
string resourceName = string.Format(
CultureInfo.InvariantCulture,
"{0}.apple-developer-merchantid-domain-association",
type.Namespace);
using (var stream = assembly.GetManifestResourceStream(resourceName))
{
if (stream == null)
{
context.Response.StatusCode = 404;
}
else
{
stream.CopyTo(context.Response.OutputStream);
context.Response.ContentType = "text/plain";
context.Response.StatusCode = 200;
}
}
}
}
}
ASP.NETの場合コアコンテンツは、wwwrootから直接静的コンテンツとして提供することができるので、より多くの方が簡単です。
Hey Tom、ファイルが配信されないという問題はありません。期間を削除し、 "。well-known /"ではなく "well-known /"にすると、ファイルはサーバーになります。だから問題は、.well-既知のパスにピリオドを追加すると、紺碧がファイルを提供していないということです。その拡張機能が欠落しているわけではありません。 –
嬉しい私の答えが助けになりました!私は経路指定を迂回し、ファイルシステムにファイルとして残しています。だから私はあなたとは違った問題に遭遇したと思う。私は自分自身の答えを探している間あなたの質問を見つけたと私はあなたが尋ねた質問への答えではないことを認めた投稿) –
これは、ASP.NET Mvcのサイトで動作しますか? –