Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "fguo"

Ok. They are identical from your code. Maybe it translates to different database queries? My table is large (100 columns with long column names). Maybe the SQL plan is over the SQL query maximum size?

How do I see the translated SQL plan? Is there a built-in method in abp to display/log the SQL plan before it executed?

Thanks,

Continue on my post above...

As my test, after the authentication process, it does redirect to the user-site and start a new session. But, it shows up the accessToken, userId, and tenantId as parameters in url address bar. What should I do to hide these into "response header"? :?: I like the clean url without any parameters in url address bar, just like the web.public site does.

BTW, on my last post, I might use "response header" instead of "response body", I guess.

Thanks for any advise!

In Log.txt, there is no ERROR, but INFO or DEBUG. Do you need it?

Do you mean your 2 codes (CODE #1 AND CODE #2) identical? I copied exactly the 2 codes as a test. The CODE #1 works same as my "where" code, returns a correct record in 2 seconds. But, the CODE #2 takes 3 minutes and return an "IIS 10.0 Detailed Error - 502.3 - Bad Gateway" error. Below is the full message:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>IIS 10.0 Detailed Error - 502.3 - Bad Gateway</title> <style type="text/css">

</style>

</head> <body> <div id="content"> <div class="content-container"> <h3>HTTP Error 502.3 - Bad Gateway</h3> <h4>The specified CGI application encountered an error and the server terminated the process.</h4> </div> <div class="content-container"> <fieldset><h4>Most likely causes:</h4> <ul> <li>The CGI application did not return a valid set of HTTP errors.</li> <li>A server acting as a proxy or gateway was unable to process the request due to an error in a parent gateway.</li> </ul> </fieldset> </div> <div class="content-container"> <fieldset><h4>Things you can try:</h4> <ul> <li>Use DebugDiag to troubleshoot the CGI application.</li> <li>Determine if a proxy or gateway is responsible for this error.</li> </ul> </fieldset> </div>

<div class="content-container"> <fieldset><h4>Detailed Error Information:</h4> <div id="details-left"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"><th>Module</th><td>   AspNetCoreModule</td></tr> <tr><th>Notification</th><td>   ExecuteRequestHandler</td></tr> <tr class="alt"><th>Handler</th><td>   aspNetCore</td></tr> <tr><th>Error Code</th><td>   0x80072ee2</td></tr>

</table> </div> <div id="details-right"> <table border="0" cellpadding="0" cellspacing="0"> <tr class="alt"><th>Requested URL</th><td>   http://localhost:22742/api/services/app/Worksheet/GetWorksheets?Ids=1657668</td></tr> <tr><th>Physical Path</th><td>   C:\dev\SNet\aspnet-core\src\SNet.Web.Host\api\services\app\Worksheet\GetWorksheets</td></tr> <tr class="alt"><th>Logon Method</th><td>   Anonymous</td></tr> <tr><th>Logon User</th><td>   Anonymous</td></tr> <tr class="alt"><th>Request Tracing Directory</th><td>   C:\Users\fguo\Documents\IISExpress\TraceLogFiles\SNET.WEB.HOST</td></tr> </table> <div class="clear"></div> </div> </fieldset> </div>

<div class="content-container"> <fieldset><h4>More Information:</h4> This error occurs when a CGI application does not return a valid set of HTTP headers, or when a proxy or gateway was unable to send the request to a parent gateway. You may need to get a network trace or contact the proxy server administrator, if it is not a CGI problem. <p><a href="http://go.microsoft.com/fwlink/?LinkID=62293&amp;IIS70Error=502,3,0x80072ee2,15063">View more information »</a></p>

</fieldset> </div> </div> </body> </html>

Any idea?

Yes. As my research, this is EF's issue. EF core seems not too friendly to DB first approach. I guess that, if an Entity defines a property without explicit initial value, it uses the implicit default values upon the data type. It results all fields having values while generating SQL script, so database default constraint never be triggered.

I do set default values in entity class's constructor, but this approach has some shortcomings:

  1. We have to manually initiate a value on all properties to match the Db table columns' default value.
  2. Our DB is shared with multiple applications. An application developer cannot control Db. If DB default value changed, all hard corded entity property initial values must be manually changed accordingly.

I tried to use fluent ValueGeneratedOnAdd() in DbContext.OnModelCreating() event. It is a better way to get Db' default value, but doesn’t work as expected in some cases. E.g. if DB default value = 1, you can’t override it as 0, because it treats 0 as null for int type, I guess.

I currently use the above two workarounds to handle the default values.

Thanks,

I am trying to attach the Log.txt here for this issue, but this forum said "The extension txt is not allowed", so I have to paste the logs on the bottom of this post.

I also tried v4.1.4. It has same issue: works fine on localhost but can't open on IIS server with same error:

Abp.AbpBootstapper - System.Exception: Could not find content root folder!

My last working version on IIS is v4.0, so I guess the issue is around the IdentityServer4, since it was added from v4.1.

My application is published on a <a class="postlink" href="http://xxxxxx.com">http://xxxxxx.com</a> without SSL certificate. Does it work with IdentityServer4?

Is it possible to simply disable IdentityServer4 in version 4.2?

Can you give me a brief guideline for deploying ASPNET Zero with IdentityServer4?

Thanks,

Here is the logs:

DEBUG 2017-08-03 17:27:34,909 [1 ] Abp.Modules.AbpModuleManager - Loading Abp modules... DEBUG 2017-08-03 17:27:34,935 [1 ] Abp.Modules.AbpModuleManager - Found 21 ABP modules in total. DEBUG 2017-08-03 17:27:34,955 [1 ] Abp.Modules.AbpModuleManager - Loaded module: *.Web.Startup.SNetWebHostModule, *.Web.Host, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,957 [1 ] Abp.Modules.AbpModuleManager - Loaded module: *.Web.SNetWebCoreModule, *.Web.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,957 [1 ] Abp.Modules.AbpModuleManager - Loaded module: *.SNetApplicationModule, *.Application, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,957 [1 ] Abp.Modules.AbpModuleManager - Loaded module: *.SNetCoreModule, *.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,957 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCoreModule, Abp.ZeroCore, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,957 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.AbpZeroCommonModule, Abp.Zero.Common, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,957 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AbpKernelModule, Abp, Version=2.2.2.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,958 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.Ldap.AbpZeroLdapModule, Abp.Zero.Ldap, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,958 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AutoMapper.AbpAutoMapperModule, Abp.AutoMapper, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,958 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.MailKit.AbpMailKitModule, Abp.MailKit, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,958 [1 ] Abp.Modules.AbpModuleManager - Loaded module: *.EntityFrameworkCore.SNetEntityFrameworkCoreModule, *.EntityFrameworkCore, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,959 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Zero.EntityFrameworkCore.AbpZeroCoreEntityFrameworkCoreModule, Abp.ZeroCore.EntityFrameworkCore, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,959 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFrameworkCore.AbpEntityFrameworkCoreModule, Abp.EntityFrameworkCore, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,959 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.EntityFramework.AbpEntityFrameworkCommonModule, Abp.EntityFramework.Common, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,959 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.IdentityServer4.AbpZeroCoreIdentityServerEntityFrameworkCoreModule, Abp.ZeroCore.IdentityServer4.EntityFrameworkCore, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,959 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.IdentityServer4.AbpZeroCoreIdentityServerModule, Abp.ZeroCore.IdentityServer4, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,959 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.AspNetCore.AbpAspNetCoreModule, Abp.AspNetCore, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,960 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.AbpWebCommonModule, Abp.Web.Common, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,960 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Web.SignalR.AbpWebSignalRModule, Abp.Web.SignalR, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,960 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Runtime.Caching.Redis.AbpRedisCacheModule, Abp.RedisCache, Version=2.2.1.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,960 [1 ] Abp.Modules.AbpModuleManager - Loaded module: Abp.Hangfire.AbpHangfireAspNetCoreModule, Abp.HangFire.AspNetCore, Version=2.2.0.0, Culture=neutral, PublicKeyToken=null DEBUG 2017-08-03 17:27:34,963 [1 ] Abp.Modules.AbpModuleManager - 21 modules loaded. FATAL 2017-08-03 17:27:35,009 [1 ] Abp.AbpBootstrapper - System.Exception: Could not find content root folder! at *.Web.WebContentDirectoryFinder.CalculateContentRootFolder() at *.EntityFrameworkCore.SNetEntityFrameworkCoreModule.PreInitialize() at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_0(AbpModuleInfo module) at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() at Abp.AbpBootstrapper.Initialize() System.Exception: Could not find content root folder! at *.Web.WebContentDirectoryFinder.CalculateContentRootFolder() at *.EntityFrameworkCore.SNetEntityFrameworkCoreModule.PreInitialize() at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_0(AbpModuleInfo module) at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() at Abp.AbpBootstrapper.Initialize() FATAL 2017-08-03 17:27:35,021 [1 ] soft.AspNetCore.Hosting.Internal.WebHost - Application startup exception System.Exception: Could not find content root folder! at *.Web.WebContentDirectoryFinder.CalculateContentRootFolder() at *.EntityFrameworkCore.SNetEntityFrameworkCoreModule.PreInitialize() at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_0(AbpModuleInfo module) at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() at Abp.AbpBootstrapper.Initialize() at Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app) at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction) at *.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass3_0.

Please discard my last post. It's my fault. I forgot to add Content Type in Header while I test it by postman.

Sorry! :oops:

Thank you for your suggestion. As a test, I tried to modify the PersonAppService.AddPhone() in Phonebook example:

    public async Task&lt;PhoneInPersonListDto&gt; AddPhone(AddPhoneInput input)
    {
           throw new Abp.UI.UserFriendlyException(401,"Test","Invalid Code");
    }

I tried to run it in Swagger UI, and got a correct response body: { "result": null, "targetUrl": null, "success": false, "error": { "code": 401, "message": "Test", "details": "Invalid Code", "validationErrors": null }, "unAuthorizedRequest": false, "__abp": true }

However, when I tried to run it by POSTMAN, I got a different error in response body: { "result": null, "targetUrl": null, "success": false, "error": { "code": 0, "message": "Your request is not valid!", "details": "The following errors were detected during validation.\r\n - \r\n", "validationErrors": [ { "message": "", "members": [ "" ] } ] }, "unAuthorizedRequest": false, "__abp": true }

Can you advise what I did wrong?

BTW, this is for a 3rd party client which I can't control. The client side just needs to receive the same error code and message as what I see in Swagger.

Thanks,

Got it. Because the Phone is defined in Person as virtual ICollection<Phone>, it is not initiated along with "new Person()". I modified my code as following (adding 2 lines with comment):

public async Task<PhoneInPersonListDto> AddPhone(AddPhoneInput input) { var person = new Person(); person.Phones = new List<Phone>(); // concrete ICollection<Phone> person.Name = "x"; person.Surname = "y";

var phone = ObjectMapper.Map<Phone>(input); person.Phones.Add(phone);

var personId = await _personRepository.InsertAndGetIdAsync(person); var phoneId = phone.Id; // Cannot get this if using InsertAsync(person).

return ObjectMapper.Map<PhoneInPersonListDto>(phone); }

It works as expected. Thank you! :)

BTW, do you think the "new List<T>(); " is the best way to initiate ICollection<T>?

Got it! In debug mode, the Log.txt is located in Web.Host\bin\Debug\net461\App_Data. It works as I expected.

Thanks,

Showing 111 to 120 of 178 entries