2
なぜ晴れたウェブサイトが私のウェブアプリケーションのカスタムヘッダーを無視するのですか?Azureのウェブサイトでカスタムヘッダーを送信できないのですか?
アイブ氏は、CORSのnugetパッケージをインストールしようとした: アイブ氏は、3つの方法を経由してヘッダーを送信しようとした
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
は最終的に私がしようとした。また、web.configファイルで設定カスタムヘッダーにしようとした
public static void Register(HttpConfiguration config)
{
config.EnableCors(new EnableCorsAttribute("*", "*", "*");
}
フィルタを作成する:
public class CorsFilter : ActionFilterAttribute
{
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
{
actionExecutedContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
}
}
上記の3つの方法はすべて動作します私のローカル開発環境で大丈夫です。しかし、私がazurewebistesに自分のアプリケーションを公開すると、私のカスタムヘッダーは無視されます。それには何らかの理由がありますか?
私はdreamsparkサブスクリプションを持っています。
はい、それが働いていませんでした – user1652792