Publish ASP.NET Core to Azure fails unexpectedly -
i have project based on asp.net core 1.0. can build , run locally without problems, if try publish project azure using publish mechanism in visual studio 2015 (even if try publish locally folder in file system or using ftp) fails unexpectedly without giving me concrete message. if run preview log:
"publish" task failed unexpectedly. system.exception: publishing project.web .netframework,version=v4.5.2/win7-x64 @ microsoft.dotnet.tasks.publish.execute() @ microsoft.build.backend.taskexecutionhost.microsoft.build.backend.itaskexecutionhost.execute() @ microsoft.build.backend.taskbuilder.<executeinstantiatedtask>d__26.movenext()
if try publish ignoring error or if not try preview this:
1>------ publish started: project: kunato.web, configuration: debug cpu ------ rmdir /s /q "c:\users\thimo\appdata\local\temp\publishtemp\kunato.web54\" environment variables: dotnet_configure_azure=1 path=.\node_modules\.bin;c:\program files (x86)\microsoft visual studio 14.0\web\external;%path%;c:\program files (x86)\microsoft visual studio 14.0\web\external\git c:\program files\dotnet\dotnet.exe publish "c:\code\git\web_kunato\src\kunato.web" --framework net452 --output "c:\users\thimo\appdata\local\temp\publishtemp\kunato.web54" --configuration debug --no-build publishing kunato.web .netframework,version=v4.5.2/win7-x64 1>publish failed due build errors. check error list more details. ========== build: 0 succeeded, 0 failed, 7 up-to-date, 0 skipped ========== ========== publish: 0 succeeded, 1 failed, 0 skipped ==========
if requested , @ error list, there no error , looks good. there other log files or check problem might be?
project.json
{ "usersecretsid": "aspnet-kunato.web-753ff034-0ada-4809-84a8-a4f157c4ea43", "dependencies": { "kunato.common": "1.0.0-*", "kunato.core": "1.0.0-*", "kunato.dataaccess": "1.0.0-*", "kunato.edi": "1.0.0-*", "kunato.entities": "1.0.0-*", "kunato.localization": "1.0.0-*", "edifabric.framework": "6.7.0", "lumenworkscsvreader": "3.9.0", "sendgrid": "6.3.4", "stackexchange.redis": "1.1.0-alpha2", "stackexchange.redis.strongname": "1.1.0-alpha2", "microsoft.applicationinsights.aspnetcore": "1.0.0", "microsoft.aspnetcore.authentication.cookies": "1.0.0", "microsoft.aspnetcore.authentication.facebook": "1.0.0", "microsoft.aspnetcore.authentication.google": "1.0.0", "microsoft.aspnetcore.authentication.microsoftaccount": "1.0.0", "microsoft.aspnetcore.authentication.twitter": "1.0.0", "microsoft.aspnetcore.diagnostics": "1.0.0", "microsoft.aspnetcore.diagnostics.entityframeworkcore": "1.0.0", "microsoft.aspnetcore.identity.entityframeworkcore": "1.0.0", "microsoft.aspnetcore.mvc": "1.0.0", "microsoft.aspnetcore.razor.tools": { "version": "1.0.0-preview2-final", "type": "build" }, "microsoft.aspnetcore.server.iisintegration": "1.0.0", "microsoft.aspnetcore.server.kestrel": "1.0.0", "microsoft.aspnetcore.staticfiles": "1.0.0", "microsoft.aspnetcore.cors": "1.0.0", "microsoft.aspnetcore.session": "1.0.0", "microsoft.extensions.caching.abstractions": "1.0.0", "microsoft.extensions.caching.redis": "1.0.0", "microsoft.entityframeworkcore.sqlserver": "1.0.0", "microsoft.entityframeworkcore.tools": { "version": "1.0.0-preview2-final", "type": "build" }, "microsoft.extensions.options.configurationextensions": "1.0.0", "microsoft.extensions.configuration.environmentvariables": "1.0.0", "microsoft.extensions.configuration.json": "1.0.0", "microsoft.extensions.configuration.usersecrets": "1.0.0", "microsoft.extensions.logging": "1.0.0", "microsoft.extensions.logging.console": "1.0.0", "microsoft.extensions.logging.debug": "1.0.0", "microsoft.visualstudio.web.browserlink.loader": "14.0.0", "microsoft.visualstudio.web.codegeneration.tools": { "version": "1.0.0-preview2-final", "type": "build" }, "microsoft.visualstudio.web.codegenerators.mvc": { "version": "1.0.0-preview2-final", "type": "build" } }, "tools": { "bundlerminifier.core": "2.0.238", "microsoft.aspnetcore.razor.tools": "1.0.0-preview2-final", "microsoft.aspnetcore.server.iisintegration.tools": "1.0.0-preview2-final", "microsoft.entityframeworkcore.tools": "1.0.0-preview2-final", "microsoft.extensions.secretmanager.tools": "1.0.0-preview2-final", "microsoft.visualstudio.web.codegeneration.tools": { "version": "1.0.0-preview2-final", "imports": [ "portable-net45+win8" ] } }, "frameworks": { "net452": {} }, "buildoptions": { "emitentrypoint": true, "preservecompilationcontext": true }, "runtimeoptions": { "configproperties": { "system.gc.server": true } }, "publishoptions": { "include": [ "wwwroot", "views", "areas/**/views", "appsettings.json", "web.config" ] }, "scripts": { "prepublish": [ "npm install", "bower install" ], "postpublish": [ "dotnet publish-iis --publish-folder %publish:outputpath% --framework %publish:fulltargetframework%" ] } }
startup.cs
using system; using system.collections.generic; using system.linq; using system.threading.tasks; using microsoft.aspnetcore.builder; using microsoft.aspnetcore.hosting; using microsoft.aspnetcore.identity.entityframeworkcore; using microsoft.entityframeworkcore; using microsoft.extensions.configuration; using microsoft.extensions.dependencyinjection; using microsoft.extensions.logging; using kunato.web.services; using kunato.dataaccess; using kunato.entities.core; using kunato.web.helpers; using system.globalization; using microsoft.aspnetcore.localization; using microsoft.extensions.options; using kunato.dataaccess.data; using newtonsoft.json.serialization; using newtonsoft.json; using microsoft.aspnetcore.mvc.modelbinding; namespace kunato.web { public class startup { public startup(ihostingenvironment env) { var builder = new configurationbuilder() .setbasepath(env.contentrootpath) .addjsonfile("appsettings.json", optional: true, reloadonchange: true) .addjsonfile($"appsettings.{env.environmentname}.json", optional: true); if (env.isdevelopment()) { // more details on using user secret store see http://go.microsoft.com/fwlink/?linkid=532709 builder.addusersecrets(); // push telemetry data through application insights pipeline faster, allowing view results immediately. builder.addapplicationinsightssettings(developermode: true); } builder.addenvironmentvariables(); configuration = builder.build(); } public iconfigurationroot configuration { get; } // method gets called runtime. use method add services container. public void configureservices(iservicecollection services) { // add application insights data collection services services container. services.addapplicationinsightstelemetry(configuration); // add framework services. services.adddbcontext<kunatodatabasecontext>(options => options.usesqlserver(configuration.getconnectionstring("defaultconnection"), b => b.migrationsassembly("kunato.web"))); services.addidentity<kunatouser, kunatorole>(options => { options.password.requiredigit = false; options.password.requiredlength = 4; options.password.requirelowercase = false; options.password.requirenonalphanumeric = false; options.password.requireuppercase = false; options.user.allowedusernamecharacters = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789@-."; options.user.requireuniqueemail = true; }) .addentityframeworkstores<kunatodatabasecontext>() .adddefaulttokenproviders(); // add session services.addsession(options => { options.cookiename = ".kunato.session"; options.idletimeout = timespan.fromminutes(30); }); // add localization services.addlocalization(); // register version service services.addsingleton<ideploymentenvironment, deploymentenvironment>(); // add localization request pipeline var dtf = new datetimeformatinfo { shortdatepattern = "dd.mm.yyyy", longdatepattern = "dd.mm.yyyy hh:mm", shorttimepattern = "hh:mm", longtimepattern = "hh:mm" }; var nf = new numberformatinfo { currencydecimalseparator = ",", currencygroupseparator = ".", numberdecimalseparator = ",", numbergroupseparator = ".", numberdecimaldigits = 3 }; // add mvc services services container. services.addmvc().addjsonoptions(options => { // handle loops correctly options.serializersettings.referenceloophandling = newtonsoft.json.referenceloophandling.ignore; // use standard name conversion of properties options.serializersettings.contractresolver = new camelcasepropertynamescontractresolver(); // include $id property in output options.serializersettings.preservereferenceshandling = preservereferenceshandling.objects; }) .addviewlocalization() .adddataannotationslocalization(); // register filters services.addscoped<languageactionfilter>(); services.configure<requestlocalizationoptions>( options => { var supportedcultures = new list<cultureinfo> { //new cultureinfo("en-us") { datetimeformat = dtf }, //new cultureinfo("en") { datetimeformat = dtf }, new cultureinfo("de-de") { datetimeformat = dtf, numberformat = nf }, new cultureinfo("de") { datetimeformat = dtf, numberformat = nf } //new cultureinfo("en-us"), //new cultureinfo("en"), //new cultureinfo("de-de"), //new cultureinfo("de") }; options.defaultrequestculture = new requestculture(culture: "de-de", uiculture: "de-de"); options.supportedcultures = supportedcultures; options.supporteduicultures = supportedcultures; }); // add application settings config services.configure<applicationsettings>(configuration.getsection("applicationsettings")); // add application services. services.addtransient<iemailsender, authmessagesender>(); services.addtransient<ismssender, authmessagesender>(); // register kunatobasedata //services.addtransient<kunatobasedata>(); //services.addtransient<kunatosampledata>(); } // method gets called runtime. use method configure http request pipeline. public async void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory) { loggerfactory.addconsole(configuration.getsection("logging")); loggerfactory.adddebug(); // add application insights request pipeline track http request telemetry data. app.useapplicationinsightsrequesttelemetry(); if (env.isdevelopment()) { app.usedeveloperexceptionpage(); app.usedatabaseerrorpage(); app.usebrowserlink(); } else { app.useexceptionhandler("/home/error"); } // more details on creating database during deployment see http://go.microsoft.com/fwlink/?linkid=615859 try { using (var servicescope = app.applicationservices.getrequiredservice<iservicescopefactory>().createscope()) { servicescope.serviceprovider.getservice<kunatodatabasecontext>().database.migrate(); // seeding basic data database var kunatobasedata = app.applicationservices.getservice<kunatobasedata>(); await kunatobasedata.initializedataasync(); // seeding sample data database //var kunatosampledata = app.applicationservices.getservice<kunatosampledata>(); //await kunatosampledata.initializedataasync(); } } catch { } app.usestaticfiles(); app.useidentity(); // add session app.usesession(); // add localization var locoptions = app.applicationservices.getservice<ioptions<requestlocalizationoptions>>(); app.userequestlocalization(locoptions.value); // add external authentication middleware below. configure them please see http://go.microsoft.com/fwlink/?linkid=532715 app.usemvc(routes => { routes.maproute( name: "default", template: "{controller=home}/{action=index}/{id?}"); }); } } }
Comments
Post a Comment