Saturday, December 23, 2017

Sharepoint framework(SpFx) gulp error -gulp serve cannot find module semver

If you get an error while trying to kick start your first SharePoint Framework solution


"gulp serve cannot find module semver"


Go to terminal and type in the below command


"npm install gulp-cli -g"


This should probably solve your issue

Tuesday, December 5, 2017

SQL data connection issue on SharePoint 2016 hosted on SQL 2016 and Windows 2016

We were trying few test migration and built our SharePoint server 2016 on top of SQL 2016 and windows 2016 . We did want to try SSRS connection after the test migration from SharePoint 2010 to SharePoint 2016 .

We were having issue with the data connection , even if we created new .rsds file and tried to connect to a DB which was hosted on SQL 2008 R2 we were receiving the error as below

"A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.)"

 I spent long hours trying to figure out if it was SharePoint issue or SSRS configuration issue even I did double check if Office online server was causing the issue , finally was able to back track the issue was with the SQL component on Windows 2016 OS . As per the new standard the SQl client hosted on Windows 2016 would not allow TLS1.0 communication and the minimum it supports in TLS1.2 .

Found a article which was put accross by Microsoft regarding the same and by installing a patch on SQL 2008 R2 and adding the necessary registry key , SQL as well as Sharepoint was able to communicate to legacy version of SQL instance .

Link --> https://blogs.msdn.microsoft.com/sqlreleaseservices/tls-1-2-support-for-sql-server-2008-2008-r2-2012-and-2014/


Thursday, October 12, 2017

Getting started with NodeJs,NPM,VsCode,Typescript and webpack

It is a quite reading if you are coming from a .net development experience to work on client side programming , below are few steps which can be used to get started with the modern web development stack .

Basically you would need a Laptop or desktop as usual :) windows or IOS license is all you need 
and then 

1)Code editor : you can use notepad++ , atom , sublime , I personally use VSCode editor (https://code.visualstudio.com/) Its completely freeeeeeeee !!
2)Git : If you need to have a repository and manage versions , you can use VSTS too . (https://git-scm.com/)
3)NodeJs :Platform used to build and test application 
4)NPM : .net developers can compare this to NugetPackage manager .this helps us to download and install the required package which will be used in the web development 
5)Typescript : You can refer this for installation , I would prefer global installation  (https://www.npmjs.com/package/typescript)
6)Task runners: Which will help to automate the development life cycle , there are many Gulp,Grunt,Webpack etc , I have used Webpack in the below sample . The help to automate compilation , bundling of the files even magnification of JS files .

Getting started : 

1)Open VS code
2)cmd (can be any terminal) -- > npm init (Package.json will be created)
3)cmd -->  npm install --save-dev typescript (Creates the local typescript files and a compile component tsc)
4)Create folder to add a  .ts file (custom coding files)
5)Create tsconfig.json and provide entries (Files to be included for transpiling)

for Webpack
1)cmd -- >npm install --save-dev ts-loader (Installs ts loader locally -this helps webpack to compile ts files)
2)cmd --> npm install --save-dev webpack (Installs webpack loacally)
3)Add "webpack.config.js" (This will be used for compiling and build )
4)run "node_modules\.bin\webpack" (provides the output of the build which is a js file which can be directly used in HTML)


Debugging
1)Add line "debugger" in any ts file
2)Open up the html in debug mode , this enters the debug mode but the code is in transpiled state , to get the code in typescript format , perform below steps
3)Open "tsConfig.json" --> add property "ComplierOptions" -->"sourceMap" :true
4)Open "Webpack.config.js --> inside exports add -->devtool: 'source-map',
5)This would load the ts file in the browser


Http-server
1)Cmd -- > Install --save-dev http-server (to install the http server locally)
Auto build through webapcak
2)webpack.config.js --> add property --> watch:true ;
3)To test or run an application in local server use cmd --> node_modules\.bin\http-server

Jquery
1)cmd --> npm install --save jquery (This will install the Jquery package globally- as this package has to be released to browser)
2)run as admin Cmd -- >npm install --save-dev @types/jquery (This will install the Jquery declaration file , this is one of the way to work with Jquery)
3)May get a error on Jquery , if so add the property "lib": ["dom","es5","es2015.iterable"]

4)cmd -- >node_modules\.bin\webpack should give you the bundled file including the Jquery library .

Get started with the project from repository
1) cmd -- > npm install  (This would install all the required package into node modules by referring the package.json)


-------------------------------------------------------------------------------------------------------------------------
tsconfig.json

{
"files": [
"./ts-src/alert.ts"
],
"compilerOptions": {
"lib": [
"dom",
"es5",
"es2015.iterable"
],
"sourceMap": true,
"outDir": "./dist1/",
"noImplicitAny": true,
"module": "commonjs",
"target": "es5",
"jsx": "react",
"allowJs": true
}

}

package.json


{
"name": "typescriptwithjquery",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"@types/jquery": "^3.2.12",
"http-server": "^0.10.0",
"ts-loader": "^2.3.7",
"typescript": "^2.5.2",
"webpack": "^3.5.6"
},
"dependencies": {
"jquery": "^3.2.1"
}
}

webpack.config.js


const path = require('path');

module.exports = {
devtool: 'source-map',//only to debug
entry: './ts-src/alert.ts',
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}]
},
resolve: {
extensions: [".tsx", ".ts", ".js"]
},
//watch:true,
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
};

alert.ts

import news from './sample'
import * as $ from 'jquery'
/*
window.onload = function(){
var a1 = new news();
a1.msg();
}
*/

$(function(){
$('#btn1').on("click",function(){
var a = new news();
a.msg();
});

});

sample.ts
import * as $ from 'jquery'

export default class message{
msg(){
$("#btn1").html('Thilosh');
alert('hi');
}
}

index.html


<html>
<head>
<script src="dist/bundle.js" ></script>
</head>
<body>
<button id="btn1" >click here</button>

</body>
</html>


Note:

--save-dev  will install the packages locally in the loacl project 
-g  will install the package global 

Tuesday, August 22, 2017

SSRS issue in SharePoint 2013 integrated mode .

I did recently come across an issue with SSRS in SharePoint 2013 integrated mode , the error was while opening up a SSRS report . Error stated as below


·        An error occurred during client rendering.
o   The requested service, 'http://serverName:32843/39c0f43bbd794f929239eb6ede09edb6/ReportStreaming.svc' could not be activated. See the server's diagnostic trace logs for more information.

The requested service, 'http://serverName:32843/39c0f43bbd794f929239eb6ede09edb6/ReportStreaming.svc' could not be activated. See the server's diagnostic trace logs for more information.


There was no much information on the above issue , only way to figured out the issue was by testing the SSRS webservice URL


open the management studio and enter below command
Get-SPRSServiceApplication

You will get the result with Name,ID and UEAccountName

You can frame the report service webapplication ID with this GUID as below

1)    http://serverName:32843/39c0f43bbd794f929239eb6ede09edb6/ReportingWebService.svc --> this URL is working fine 
12)http://serverName:32843/39c0f43bbd794f929239eb6ede09edb6/ReportStreaming. à this one throws a error as below 


Memory gates checking failed because the free memory (208904192 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.



Increasing the RAM of the server resolved the issue

Thursday, August 10, 2017

Secure store service issue in SharePoint 2013

Recently were trying some tests on migration of SharePoint 2010 contents to SharePoint 2016 , having SharePoint 2013 as intermediary server without which the migration will not be successful .

Had this weird issue of Secure store service application not being created in SharePoint 2013, the farm was built by someone a yr ago , so did not have the full data on the issue , but below were the errors in ULS

Microsoft.SharePoint.SPException: Your session has expired. Restart this wizard to continue.  
 at Microsoft.SharePoint.Administration.SPScenarioContext.GetContext(Page page, CultureInfo culture)   
 at Microsoft.Office.SharePoint.ClientExtensions.SecureStoreAdministration.CreateSSSApplicationStateInfo.OnLoad(EventArgs e) 

Application error when access /_admin/sssvc/createsssvcapplicationstateinfo.aspx, Error=Your session has expired. Restart this wizard to continue. 


The current state '_admin/sssvc/createsssvcapplication.aspx' doesn't match the Page '_admin/sssvc/createsssvcapplicationstateinfo.aspx'


I was unable to fix this issue not the root cause of it yet , but figured it out that this was an issue only through the UI , so I could still go ahead the create a new Secure store service application through power shell 

New-SPSecureStoreServiceApplication -ApplicationPool "app pool name which already exists" -AuditingEnabled:$false -DatabaseServer "devomasp02" -DatabaseName "Secure store SANew"-Name "Secure store SANew"

$secureStoreApplicationName  ="Secure Store Service Application"
Get-SPServiceApplication | ? {$_.GetType().Equals([Microsoft.Office.SecureStoreService.Server.SecureStoreServiceApplication])} | New-SPSecureStoreServiceApplicationProxy -Name $secureStoreApplicationProxyName -DefaultProxyGroup | Out-Null

I shall look into issue and keep posted if I fix it