我有一个ASP.NET Core应用程序托管为URL下的Azure Web应用程序:
https://my-webapp-url.azurewebsites.net/
这是我的网络配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1048576000" />
</requestFiltering>
</security>
<handlers>
<remove name="aspNetCore" />
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\My.WebApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
任何用户都可以访问:
https://my-webapp-url.azurewebsites.net/info
页上查看我的应用的运行状况https://my-webapp-url.azurewebsites.net/swagger
页以查看我的应用程序的API文档我的问题如下:
https://my-webapp-url.azurewebsites.net/my-extra-file.html
这样的硬编码路径,以便在请求此URL时HTML页面将返回,需要做些什么?当前,如果我在Web应用程序的my-extra-file.html
目录中拥有wwwroot
,并且尝试访问https://my-webapp-url.azurewebsites.net/my-extra-file.html
,则得到404.0。
在此先感谢您,并感谢您的任何错误。
答案 0 :(得分:0)
我将总结并发布为回复。
使用Asp.net核心mvc应用程序时,需要在{
"_id": {
"$oid": "5c8fb15c30801ghiu865gf45"
},
"name": "",
"description": ""
}
类的 class MonkeyWebViewClient2 : WebViewClient {
ImageView _imgViewBack,_imgViewForward, _imgRefresh;
public MonkeyWebViewClient2(ImageView imgViewBack,ImageView imgViewForward,ImageView imgRefresh){
_imgViewBack = imgViewBack;
_imgViewForward = imgViewForward;
_imgRefresh = imgRefresh;
}
public override void OnPageStarted (WebView view, string url, Bitmap favicon)
{
base.OnPageStarted (view, url, favicon);
_imgRefresh.SetImageResource (Resource.Drawable.close);
if(view.CanGoBack()){
_imgViewBack.SetImageResource(Resource.Drawable.back_black_arrow);
}else {
_imgViewBack.SetImageResource(Resource.Drawable.NavArrowLeft);
}
if (view.CanGoForward()) {
_imgViewForward.SetImageResource (Resource.Drawable.ArrowRight2);
} else {
_imgViewForward.SetImageResource (Resource.Drawable.NavArrowRight);
}
_imgRefresh.Click += (sender, e) => view.StopLoading ();
//Console.WriteLine ("OnPageStarted");
}
public override void OnPageFinished (WebView view, string url)
{
base.OnPageFinished (view, url);
_imgRefresh.SetImageResource (Resource.Drawable.refresh_icon);
if (view.CanGoBack ()) {
_imgViewBack.SetImageResource (Resource.Drawable.back_black_arrow);
} else {
_imgViewBack.SetImageResource (Resource.Drawable.NavArrowLeft);
}
if (view.CanGoForward ()) {
_imgViewForward.SetImageResource (Resource.Drawable.ArrowRight2);
} else {
_imgViewForward.SetImageResource (Resource.Drawable.NavArrowRight);
}
_imgRefresh.Click += (sender, e) => view.Reload ();
AndHUD.Shared.Dismiss();
}
}
protected override void OnPause()
{
base.OnPause();
if (InformationWebView != null)
{
InformationWebView.OnPause();
}
}
protected override void OnResume()
{
base.OnResume();
if (InformationWebView != null)
{
InformationWebView.OnResume();
}
}
public override void OnBackPressed (){
Finish();
}
}
方法中添加app.UseStaticFiles();
。这样,网络服务器就可以托管html,css,javascript和图片之类的静态文件。
然后在Configure
文件夹下创建.html文件,您将可以访问它。