<cite>ismcagdas: </cite> Hi,
Can you lastly share your DTO which contains CountryId field ?
Thanks.
Your question just helped me find the root cause of the countryId error. This WAS in my DTO:
public int CountryId { get; set; }
I changed it to this NOW:
public int? CountryId { get; set; }
This resolved the error!
I have a couple of questions for support team on this issue.
I tried by applying the following code into my createModal.js file for Prospect.
if (prospect.AddressType === "null") {
prospect.AddressType = null;
}
if (prospect.Salutation === "null") {
prospect.Salutation = null;
}
if (prospect.Gender === "null") {
prospect.Gender = null;
}
I added one of these IF conditions for each of the dropdowns where I am getting the validation. It works for all but one of the one shown below?
if (prospect.CountryId === "null") {
prospect.CountryId = null;
}
App service POST values sent: [https://drive.google.com/file/d/0B5HAoiVVXzY7X2NvYWUzd3ZWcFE/view?usp=sharing])
Validation Error on country Id: [https://drive.google.com/file/d/0B5HAoiVVXzY7My1qN2dORUs4ems/view?usp=sharing])
It still keeps reporting the same error message on this one dropdown now. Even though a value of "null" is being set. This is completely baffling! :?
<cite>ervingayle: </cite> As a test have you tried to DisableValidation on the controller method? <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Validating-Data-Transfer-Objects">https://aspnetboilerplate.com/Pages/Doc ... er-Objects</a>
Also on the views do you have an AntiForgeryToken? Something like: @Html.AntiForgeryToken()
I had similar issues with my jQuery forms but not specific to the 4.4 upgrade rather from aspnetboilerplate.
Thanks for your tips and suggestions. I tried the disable validation on the app service method that is getting called and it did not make a difference! As for the AntiForgeryToken I have never used that on any of my pages and as per what I read in the ABP docs, it is automatically included in all pages by the ABP framework. So not sure if that would make any difference. Thanks again!
<cite>ismcagdas: </cite> Hi @exlnt,
Can you appl changes in this file to your version (Areas/Mpa/Views/HostSettings/Index.js) <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/commit/1ffb32a129854c45ebed12958563f8ed3d528849#diff-0ee402dc6b494081c40364034de66cf7">https://github.com/aspnetzero/aspnet-ze ... 034de66cf7</a>
Thanks.
I can live with the issue on the maintenance page as I dont need to use it that often. I only showed that to you as example of the issue I am facing on my custom entity page. How does this fix apply to my custom entity form?
Well this issue is now solved! Not sure what happened, but I restarted Visual Studio 2017 and tried the same line of code and was able to compile without any errors! I deployed my updated app to the hosting site and was able to create the new tenanat without MSDTC error.
I just deployed my application to my hosting site and I was doing the setup for my domain from the "maintenance" page in the host application. Even on that page, I ran into the exact same error with a dropdown, see image below, on the edition dropdown. [https://drive.google.com/file/d/0B5HAoiVVXzY7S2VzMzMtVWZWdDg/view?usp=sharing]) If I choose an edition and then click SAVE, the error does not happen. So essentially you are forced to select something in the dropdown. This is an exact replication of the problem I am facing on my "prospect" entity form dropdowns.
I just deployed my V4.X application to my hosting provider for the first time after I completed the upgrade to V4.X. When I attempt to create a new tenant, I get the below error related to MSDTC.
System.Data.Entity.Core.EntityException: The underlying provider failed on Open. ---> System.Transactions.TransactionManagerCommunicationException: Network access for Distributed Transaction Manager (MSDTC) has been disabled. Please enable DTC for network access in the security configuration for MSDTC using the Component Services Administrative tool. ---> System.Runtime.InteropServices.COMException: The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)
at System.Transactions.Oletx.IDtcProxyShimFactory.ReceiveTransaction(UInt32 propgationTokenSize, Byte[] propgationToken, IntPtr managedIdentifier, Guid& transactionIdentifier, OletxTransactionIsolationLevel& isolationLevel, ITransactionShim& transactionShim)
at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)
--- End of inner exception stack trace ---
at System.Transactions.Oletx.OletxTransactionManager.ProxyException(COMException comException)
at System.Transactions.TransactionInterop.GetOletxTransactionFromTransmitterPropigationToken(Byte[] propagationToken)
at System.Transactions.TransactionStatePSPEOperation.PSPEPromote(InternalTransaction tx)
at System.Transactions.TransactionStateDelegatedBase.EnterState(InternalTransaction tx)
at System.Transactions.EnlistableStates.Promote(InternalTransaction tx)
at System.Transactions.Transaction.Promote()
at System.Transactions.TransactionInterop.ConvertToOletxTransaction(Transaction transaction)
at System.Transactions.TransactionInterop.GetExportCookie(Transaction transaction, Byte[] whereabouts)
at System.Data.SqlClient.SqlInternalConnection.GetTransactionCookie(Transaction transaction, Byte[] whereAbouts)
at System.Data.SqlClient.SqlInternalConnection.EnlistNonNull(Transaction tx)
at System.Data.SqlClient.SqlInternalConnection.Enlist(Transaction tx)
at System.Data.SqlClient.SqlInte...
This is the exact same error I reported early this year: [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=4906]) I tried to apply the same code fix (below) to my V4.X solution but it will not compile.
//20170130 - Added for disabling MSDTC transactions
Configuration.ReplaceService<IEfTransactionStrategy, DbContextEfTransactionStrategy>(DependencyLifeStyle.Transient);
In V4.X, Is there another way to disable MSDTC?
I am running into another validation issue on one of my forms. I cannot figure out how to fix this issue. I'm not saying this is an issue of the aspnetzero template. But this was code that was working just fine prior to my V4.x upgrade. I have an entity named "Prospect" in my application. The create modal for this entity only has about 4/5 required fields, everything else is optional and no values are required by the user. However the ABP validation mechanism is firing an error message on my all my optional fields (all dropdowns). All my dropdowns have a value of "null" on the seed entry.
var defaultItem = new ComboboxItemDto("null", L("NotAssigned"));
I copied this from the edition app service below.
public async Task<List<ComboboxItemDto>> GetEditionComboboxItems(int? selectedEditionId = null)
{
var editions = await _editionManager.Editions.ToListAsync();
var editionItems = new ListResultDto<ComboboxItemDto>(editions.Select(e => new ComboboxItemDto(e.Id.ToString(), e.DisplayName)).ToList()).Items.ToList();
var defaultItem = new ComboboxItemDto("null", L("NotAssigned"));
editionItems.Insert(0, defaultItem);
if (selectedEditionId.HasValue)
{
var selectedEdition = editionItems.FirstOrDefault(e => e.Value == selectedEditionId.Value.ToString());
if (selectedEdition != null)
{
selectedEdition.IsSelected = true;
}
}
else
{
defaultItem.IsSelected = true;
}
return editionItems;
}
Here are the errors logged in the log file: [https://drive.google.com/file/d/0B5HAoiVVXzY7T0pzVVh3NWY5VU0/view?usp=sharing]). All of the fields mentioned in the log file are optional and should not be flagged by the ABP validation method as errors.
Can someone help me on how I can suppress this validation error?
<cite>ismcagdas: </cite> Hi @exlnt,
Sorry for the late response. Can you share input dto for UpdateCountry method ? We will check it.
Thanks.
@ismcagdas - Thanks very much for following up on this thread, I really do appreciate it! I was able to find errors in my log files that helped me find root cause of the validation errors. There was a conversion failure happening in JSON.Net.
I am trying to do the exact same thing, I need to put some seed data into my tenant DB tables. Is there any way to achieve this in the .NET Core solution?