我試圖部署在Azure中http://iberodev.azurewebsites.net我的web應用程序不會在Azure中工作 - 錯誤00000000
應用程序使用的身份,IdentityServer4,實體框架的核心,等 一個應用程序,它有一些新公共管理和亭子的依賴它使用gulp從SASS生成CSS等。 漂亮的標準網絡應用程序。
工作一切良好,在當地 發佈到Azure的時候我沒有得到任何錯誤,我可以看到我所有的DLL和wwwroot文件組件存在。
當我訪問應用程序時,它顯示一個空白頁。但是我可以看到應用程序正在運行(它返回favicon.ico,並且它到達中間件管道)。
我在Azure中啓用了一些日誌記錄,我可以看到,只要我向應用發送請求,就會導致500內部服務器錯誤。但它沒有給出太多細節:
錯誤是00000000
我如何能更好地解決這個問題或可能是什麼你知道嗎?我用完了想法。
這是我在Azure中
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!--
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\Iberodev.Web.dll" stdoutLogEnabled="false" stdoutLogFile="\\?\%home%\LogFiles\stdout" forwardWindowsAuthToken="false" />
<rewrite>
<rules>
<!-- BEGIN rule TAG FOR HTTPS REDIRECT -->
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<!-- END rule TAG FOR HTTPS REDIRECT -->
</rules>
</rewrite>
</system.webServer>
</configuration>
的web.config和我project.json是很簡單太:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Iberodev.Common": "1.0.0",
"Iberodev.Data": "1.0.0",
"Iberodev.Data.SqlServer": "1.0.0",
"Iberodev.Web.Model": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"web.config"
]
},
"scripts": {
"prepublish": [
"npm install",
"bower install",
"dotnet bundle",
"gulp clean",
"gulp compile"
],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"version": "1.0.0"
}
這是我的啓動類 公共類啓動 { 私人只讀IHostingEnvironment _env; public IConfigurationRoot Configuration {get;私人設置; }
public Startup(IHostingEnvironment env)
{
_env = env;
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(Constants.IberodevisSettings.SETTINGS_FILE_FULLNAME, optional: true, reloadOnChange: true)
.AddJsonFile($"{Constants.IberodevisSettings.SETTINGS_FILE_NAME}.{env.EnvironmentName}.{Constants.IberodevisSettings.SETTINGS_FILE_EXTENSION}", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public void ConfigureServices(IServiceCollection services)
{
var connectionString = Configuration.GetConnectionString("DefaultConnection");
var migrationsAssembly = typeof(Startup).GetTypeInfo().Assembly.GetName().Name;
// AspNet Core Identity
services.AddIdentity<User, Role>(config => {
config.User.RequireUniqueEmail = Constants.IdentityValues.REQUIRE_UNIQUE_EMAIL;
config.Password.RequiredLength = Constants.IdentityValues.PASSWORD_MIN_LENGTH;
config.Password.RequireDigit = Constants.IdentityValues.REQUIRE_DIGIT;
config.Password.RequireUppercase = Constants.IdentityValues.REQUIRE_UPPERCASE;
config.Password.RequireNonAlphanumeric = Constants.IdentityValues.REQUIRE_NON_ALPHANUMERIC;
})
.AddEntityFrameworkStores<IberodevContext, Guid>()
.AddDefaultTokenProviders()
.AddUserStore<UserStore<User, Role, IberodevContext, Guid>>();
//Add EF services
services.AddDbContext<IberodevContext>(options =>
{
options.UseSqlServer(connectionString,
sqlServerOptions => sqlServerOptions.MigrationsAssembly(migrationsAssembly));
});
// Identity Server 4.
services.AddIdentityServer()
.AddInMemoryStores()
.AddInMemoryClients(ConfigInMemory.GetClients("http://localhost:8080"))
.AddInMemoryScopes(ConfigInMemory.GetScopes())
.AddAspNetIdentity<User>();
// AspNet Core MVC
services.AddMvc();
BootstrapServices(services);
BootstrapRepositories(services);
}
private void BootstrapServices(IServiceCollection services)
{
services.AddScoped<IUserService, UserService>();
}
private void BootstrapRepositories(IServiceCollection services)
{
services.AddScoped<IUserRepository, UserRepository>();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
var logLevel = env.IsDevelopment() ? LogLevel.Debug : LogLevel.Information;
loggerFactory.AddConsole(logLevel);
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
//ASP.NET Core Identity (adds cookie authentication)
app.UseIdentity();
app.UseIdentityServer(); // it relies on the authentication cookie Identity creates, so it must be after.
app.UseStaticFiles();
app.UseMvcWithDefaultRoute();
}
}