Base solution for your next web application
Ends 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!

I am trying ASPNet Core & Angular 4.4.0. The Web.Public project is MVC version. When I publish it, it deploys with all other projects. Do we have an Angular 2 version of Web.Public available? :?:

The reason I am asking is that, I need to build a separate Angular2 SPA for non-admin users. Similar to the Web.Public, the user needs to click the "Login" on that SPA for authentication. I can make a link to direct the login request on admin site: <a href="adminSite/account/login??ss=true&returnUrl=userSite/home">Login</a>

After the authentication, there must be a response body redirected back to the user site and start the session, I guess. What json object is in the "response body"? How do I access the "response body" to get session info, such as user-name? :?:

Can you give me a brief sample code?

Thanks,

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?

"WhereIf" is handy in scenario of multiple input items, and it works fine with small data, as my test. However, it seems something wrong when I recently worked with a database table with about 100 columns and 200k records. The table is named as "Worksheets". I am trying to make a "GetWorksheets" service. The code likes:

    public ListResultDto&lt;WorksheetListDto&gt; GetWorksheets(GetWorksheetsInput input)
    {
        var worksheets = _worksheetRepository
            .GetAll()
            //.Where(w=> (input.WorksheetIds != null && input.WorksheetIds.Any() && input.WorksheetIds.Contains(w.Id)))
            .WhereIf((input.WorksheetIds != null && input.WorksheetIds.Any()), w => input.WorksheetIds.Contains(w.Id))
            .OrderBy(w => w.Id)
            .ToList();
        return new ListResultDto&lt;WorksheetListDto&gt;(ObjectMapper.Map&lt;List&lt;WorksheetListDto&gt;>(worksheets));
    }

It takes about 3 minutes to return a result for a single Id in input, while I test it on Swagger.

I tried to replace the "WhereIf" with a regular "Where" (the comment out line above). It only takes 2 seconds to return a result.

Why the "WhereIf" is so slow? Did I miss something to use it?

Thanks,

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 need to persist an entity instance into database table. The table has columns with default constraint. When I directly run a sql insert statement, the default values correctly inserted. However, if I insert the entity by IRepository.InsertAndGetIdAsync(), the default values are always null or DBNull.

For example, a table with 3 int type columns: T.col1, T.col2, and T.col3. The T.col2 is nullable and has a default constraint of value 2, and T.col3 is not allowed null and has default constraint of value 3.

If I run insert statement: insert into T (col1) values (1) It results correctly as col1=1, col2=2, and col3=3.

When I use IRepository.InsertAndGetIdAsync() like:

var t=new T(); t.col1=1; IRepository<T>.InsertAndGetIdAsync(t);

The data table in database inserts a record with values of col1=1, col2=NULL, col3=0.

It likes that the IRepository<T>.InsertAndGetIdAsync(t) does not respect the database rule. What do I miss?

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.

I am trying Core+Angular v4.2.1. It works fine on localhost, but cannot open Swagger UI after deployed on server. It shows "An error occurred while starting the application" . The Log file records a FATAL error:

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

I traced the code file (*.Core\Web\WebContentFolderHelper.cs) which contains this exception message, but can't get any clue. My last version v4.0 has no such problem. It deployed same way on same IIS folder with same with same appsettings.

I have verified that the production database has no problem. I can connect it from localhost.

Do you have any idea/clue/suggestion?

Thanks,

Showing 161 to 170 of 254 entries