Tuesday, October 3, 2017

Excel Services Issues Troubleshooting (2013/2010)

After updating Excel file on SharePoint from which a chart is published on SharePoint through Excel Service webpart, you run into an error "We're sorry. We ran into a problem completing your request. Please try that again in few minutes."

Solution: give it 3-5 minutes. If the worksheet chart used to work on SharePoint webpart before and if you did not modify the data connection(s), try again later. It seems to take a while for SharePoint to handle the updated Excel files in the back-end.

If the problem persists...

1. Check if Excel Services is running.
Central Administration -> System Settings -> Manage Services on Server -> Excel Calculation Service -> Check if "Started"

2.  Check if Excel Service Application is associated to Web Application in question.
Central Administration -> Application Management -> Manage Web Applications -> Select Web Application -> Configure Service Associations

3. Check if Trusted File Location is configured for Excel Service Application.
Central Administration -> Application Management -> Manage Service Applications -> Excel Service Application  -> Trusted file location -> Add  trusted file location -> Add address as https:// and Location Type as Microsoft SharePoint Foundation -> Keep the rest as is

4.  Check if document library configured to open documents in browser.
Site -> Library -> Library Settings -> Advanced Settings -> Check for "Opening Documents in the Browser"  Use either Server Default(Open in Browser) or Open in the Browser.

5. Grant "Excel Service Account" access to SharePoint Content database via PowerShell.

$wp = Get-SPWebApplication -identity
$wp.GrantAccessToProcessIdentity("Domain\Account that runs Excel Service")

**To check for service account - Central Administration -> Security -> Configure service accounts

6. Check if SharePoint Web Services in IIS has ASP.NET Impersonation disabled.
Select SharePoint Web Services from list of available of sites. -> Select Authentication from right panel and available authentications are displayed. -> Disable ASP.NET Impersonation if enabled.


Sunday, August 27, 2017

Make Windows 10 run faster

Below are tips to make Windows 10 run faster. This is useful when using Windows 10 virtual machine on a resource-limited developer PC or laptop.
  1. Disable Windows Search service
  2. Disable Windows Update service (please perform Windows update manually from time to time)
  3. Disable Telemetry and Data Collection service
    1. Open Registry Editor
    2. Go to
      HKLM\SOFTWARE\Policies\Microsoft\Windows\DataCollection
    3. Create a 32-bit DWORD value named AllowTelemetry and set it to 0.
    4. Open Services and disable the following services.
      1. Diagnostic Tracking Service or Connected User Experiences and Telemetry
      2. dmwappushsvc
  4. Disable Windows Defender
    1. Open Registry Editor
    2. Go to
      HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender
    3. Create a 32-bit DWORD value named DisableAntiSpyware and set it to 1.
  5. Restart Windows 10
  6. Run .NET Optimization manually via PowerShell (this could take 10-20 min).
    1.  Get-ChildItem $env:SystemRoot\Microsoft.net\NGen.exe -recurse | ForEach-Object { & $_ executeQueuedItems }
      
  7. Restart Windows 10

Saturday, July 29, 2017

"vertical-align: middle" that works anywhere

Outside a table cell, vertical-align: middle does not work as expected. The following is a css that allows any child element to be positioned at center vertically and horizontally.

text-align: center works in most cases. However, it does not place a child element in perfect center position. It generally places the left-most edge of child element to the center horizontally, giving the look of off-to-right appearance of the child element.

.cell {
 position: relative;
 border: 1px solid #587cdd; 
 border-radius: 5px; 
 margin: 5px;
 width: 50px; 
 height: 50px;
 text-align: center;
 float: left;
 -webkit-transform-style: preserve-3d;
 -moz-transform-style: preserve-3d;
 ransform-style: preserve-3d;
}
.content {
 position: absolute; 
 top: 50%; 
 left: 50%;
 transform: translate(-50%, -50%); 
 -webkit-transform: translate(-50%, -50%);
 -ms-transform: translate(-50%, -50%);
}

<script src="https://unpkg.com/vue"></script>

<div id="app">
 <span class="cell" v-for="n in 10">
  <span class="content">{{ n }}</span>
 </span>
</div>

new Vue({
 el: '#app',
 
});

The above code will produce the following. Each square has content with dead center position: both horizontally and vertically.

Thursday, June 8, 2017

Tuesday, May 16, 2017

Maximum request length exceeded

ASP.NET by default has a limit of 4 MB of file upload. In order to bump up this limit, web.config needs to be updated. Below is example to allow 1 GB of file upload (1 GB = 1048576 KB = 1073741824 Bytes).
<configuration>
 <system.web>
  <httpRuntime maxRequestLength="1048576" />
 </system.web>
</configuration>
For IIS 7 or later, the following is also needed. Max size value in KB and Bytes must match in both places.
<system.webServer>
 <security>
  <requestFiltering>
   <requestLimits maxAllowedContentLength="1073741824" />
  </requestFiltering>
 </security>
</system.webServer>
In order to specify execution timeout, add executionTimeout value in seconds as follows.
<configuration>
 <system.web>
  <httpRuntime maxRequestLength="1048576" executionTimeout="3600" />
 </system.web>
</configuration>

Thursday, May 4, 2017

Remove time info from getdate()

In SQL Server, a quick efficient way to remove time info from getdate() is

Select [Today] = DateAdd(dd, DateDiff(dd, 0, getdate()), 0)


The result would be something like '2017-05-04 00:00:00.000', which is handy when comparing against date-only column values.

Wednesday, May 3, 2017

SQL Server Transaction - Basic Syntax Example

A quick refresher on proper SQL Server transaction syntax example:

BEGIN TRANSACTION;
BEGIN TRY

    UPDATE dbo.Users set Acitve = 1 Where UserID = 23398

END TRY
BEGIN CATCH

    SELECT 
        ERROR_NUMBER() AS ErrorNumber
       ,ERROR_SEVERITY() AS ErrorSeverity
       ,ERROR_STATE() AS ErrorState
       ,ERROR_PROCEDURE() AS ErrorProcedure
       ,ERROR_LINE() AS ErrorLine
       ,ERROR_MESSAGE() AS ErrorMessage;

    IF @@TRANCOUNT > 0
        ROLLBACK TRANSACTION

END CATCH

IF @@TRANCOUNT > 0
    COMMIT TRANSACTION