Wednesday, 24 May 2017
Thursday, 18 May 2017
Cannot start service from the command line or a debugger
Cannot start service from the command line or a debugger. A Windows Service must first be installed (using installutil.exe) and then started with the ServerExplorer, Windows Services Administrative tool or the NET START command
When you run windows service debug mode from VS, i got above error.
Solution:
OOTB code:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Scheduler()
};
ServiceBase.Run(ServicesToRun);
}
}
Change to:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
//ServiceBase[] ServicesToRun;
//ServicesToRun = new ServiceBase[]
//{
// new Scheduler()
//};
//ServiceBase.Run(ServicesToRun);
var myService = new Scheduler();
if (Environment.UserInteractive)
{
MtProject.Scheduler objScheduler = new Scheduler();
objScheduler.GetData();
}
else
{
var servicesToRun = new ServiceBase[] { myService };
ServiceBase.Run(servicesToRun);
}
}
}
When you run windows service debug mode from VS, i got above error.
Solution:
OOTB code:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new Scheduler()
};
ServiceBase.Run(ServicesToRun);
}
}
Change to:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
//ServiceBase[] ServicesToRun;
//ServicesToRun = new ServiceBase[]
//{
// new Scheduler()
//};
//ServiceBase.Run(ServicesToRun);
var myService = new Scheduler();
if (Environment.UserInteractive)
{
MtProject.Scheduler objScheduler = new Scheduler();
objScheduler.GetData();
}
else
{
var servicesToRun = new ServiceBase[] { myService };
ServiceBase.Run(servicesToRun);
}
}
}
Saturday, 13 May 2017
Process with an ID #### is not running in visual studio
Solution:
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
Restart VS.
Run the application
Close VS.
Navigate to the folder of the solution and delete the hidden .vs folder.
Restart VS.
Run the application
Friday, 12 May 2017
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
Additional information: String was not recognized as a valid DateTime.
I got above error, but same code was working from another system.
My config:
<add key="sDate" value="16-02-2012 11:13:23"/>
Root cause: The system which i am running the code is having local date format as DD/M/YYYY
But the my input is having MM/DD/YYYY
Solution:
Option 1: Change sDate from <add key="sDate" value="16-02-2012 11:13:23"/> Value to
<add key="sDate" value="02-16-2012 11:13:23"/>
Option 2: Change system date format to MM/DD/YYYY
Additional information: String was not recognized as a valid DateTime.
I got above error, but same code was working from another system.
My config:
<add key="sDate" value="16-02-2012 11:13:23"/>
Root cause: The system which i am running the code is having local date format as DD/M/YYYY
But the my input is having MM/DD/YYYY
Solution:
Option 1: Change sDate from <add key="sDate" value="16-02-2012 11:13:23"/> Value to
<add key="sDate" value="02-16-2012 11:13:23"/>
Option 2: Change system date format to MM/DD/YYYY
vcvarsall.bat missing
Error The command "call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\..\..\vc\vcvarsall.bat" x86
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\..\..\vc\bin\EditBin.exe"
The vcvarsall.bat file is in C:\program files(x86)\Microsoft Visual Studio 14.0\VC\.
Go to Control Panel -> Uninstall a program
Select visual studio 2015, right click, Change -> Modify
Select Visual C++ tools is selected under programming languages
Click on Install
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\..\..\vc\bin\EditBin.exe"
The vcvarsall.bat file is in C:\program files(x86)\Microsoft Visual Studio 14.0\VC\.
Go to Control Panel -> Uninstall a program
Select visual studio 2015, right click, Change -> Modify
Select Visual C++ tools is selected under programming languages
Click on Install
Tuesday, 2 May 2017
anguler js sample
<script>
var myApp = angular.module("myApp", []);
(function (app) {
"use strict";
app.controller("productController", function ($scope, $http) {
$scope.SendData = function (Data) {
alert('ff');
var GetAll = new Object();
GetAll.FirstName = Data.firstName;
GetAll.SecondName = Data.lastName;
GetAll.SecondGet = new Object();
GetAll.SecondGet.Mobile = Data.mobile;
GetAll.SecondGet.EmailId = Data.email;
$http({
url: "NewRoute/firstCall",
dataType: 'json',
method: 'POST',
data: GetAll,
headers: {
"Content-Type": "application/json"
}
}).success(function (response) {
$scope.value = response;
})
.error(function (error) {
alert(error);
});
}
});
})(myApp);
</script>
<body ng-app="myApp" ng-controller="productController">
<hr />
<h3>
Send Objects of Objects Using AngularJS
</h3>
<hr />
<div>
<hr />
<div>
First Name:
<input type="text" placeholder="Enter your name" ng-model="details.firstName">
Last Name:
<input type="text" placeholder="Enter your last name" ng-model="details.lastName">
</div>
<hr />
<div>
Mobile Number:
<input type="text" placeholder="Enter your mobile number" ng-model="details.mobile">
EmailId:
<input type="text" placeholder="Enter your email id" ng-model="details.email">
</div>
<input type="button" ng-click="SendData(details)" value="Submit" />
<hr />
<h4 style="color:blueviolet">{{value}}</h4>
</div>
<hr />
</body>
</html>
refer: http://www.c-sharpcorner.com/article/modules-and-controller-in-angularjs/
Subscribe to:
Posts (Atom)