I have an MVC 3 application that works fine when running locally from visual studio,
There are two bat files that pre compile the application ready for deployment, when i run the bat files and upload the deployment folder to the web server a load of errors are thrown including a null exception error,
The error can be seen by visiting the following URL, i can also provide the full stack trace on a document if required, i didnt want to post it here as its so big.
I cant understand where the error is coming from as everything works locally, t seems these errors are being created when the bat files are compiling the application, has anyone had similar experiences after deploying an MVC app? can anyone offer any advice on what may be causing the problem?
Thanks
Liam
UPDATE=============
This is the GetTax method, this code has been thoroughly tested as its part of NopCommerce 2.2, the errors only occur after the solution is compiled via the BAT files which is again standard for building a nop commerce 2.2 app, am i right in thinking its got to be something on my machine that is causing these problems when the BAT files are ran and the code is compiled for deployment?
public virtual decimal GetTaxRate(ProductVariant productVariant, int taxCategoryId,
Customer customer)
{
//tax exempt
if (IsTaxExempt(productVariant, customer))
{
return decimal.Zero;
}
//tax request
var calculateTaxRequest = CreateCalculateTaxRequest(productVariant, taxCategoryId, customer);
//make EU VAT exempt validation (the European Union Value Added Tax)
if (_taxSettings.EuVatEnabled)
{
if (IsVatExempt(calculateTaxRequest.Address, calculateTaxRequest.Customer))
{
//return zero if VAT is not chargeable
return decimal.Zero;
}
}
//active tax provider
var activeTaxProvider = LoadActiveTaxProvider();
//get tax rate
var calculateTaxResult = activeTaxProvider.GetTaxRate(calculateTaxRequest);
if (calculateTaxResult.Success)
return calculateTaxResult.TaxRate;
else
return decimal.Zero;
}
The stack trace indicates that it’s coming from the method
GetTaxRateinTaxService.cs. I’m guessing this isn’t anything ASP.NET MVC specific, but a deployment issue. It could be database permissions or connection strings.. you’ll have to check what that method is doing.