Saturday, July 9, 2022

VS Code # Warning - npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead

Error : VS Code - NPM Warning - npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead

Solution: 

Follow below steps :-

1. Open a text editor like Notepad++ in Administrator mode

2. Modify the below 4 files 

  1. Go to C:\Program Files\nodejs
  2. Edit 4 files - npm, npm.cmd, npx, npx.cmd
  3. Replace "prefix -g" with "prefix --location=global" in all 4 files 
  4. Save all files

Hope this helps !

VSCode # The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program

Error : VSCode The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program

Solution:

If you have installed node while VS Code was opened, Try closing the Editor and then reopen the editor again. 

Why this is required? 

- If node is installed while VS Code was opened then the change to the PATH won't be visible yet. 

- Make sure that "add to PATH option" is selected while installing node.

- If not done, make sure to add it to the PATH environment variable


Hope this helps !

Saturday, November 13, 2021

Visual Studio 2019 # Project references are shown as missing; despite them being in the project file

Visual Studio 2019 # Project references are shown as missing; despite them being in the project file

Solution :

Follow the steps as mentioned below - this should resolve the issue

Step 1 : Close the solution in Visual Studio

Step 2 :  Go to the solution folder --> Delete the hidden folder .vs 

Step 3 : Delete "bin" and "obj" folders under the project folders in the solution

Step 4 : Re-Open Solution in Visual Studio

Step 5 : Clean and Rebuild the Solution

Friday, May 22, 2020

Windows10 # VS2017 # Unable to launch the IIS Express Web server

Problem Statement : Windows 10 # VS 2017 # Unable to launch the IIS Express Web server

Solution:

Run the following command from an administrator command prompt: 
netsh http add iplisten ipaddress=::

Example: 
C:\Users\Admin>netsh http add iplisten ipaddress=::
IP address successfully added

This worked for me for Windows 10, VS 2017

Sunday, May 17, 2020

Google Maps API Activation error - Getting "ApiNotActivatedMapError" when trying to use embed map API

Problem Statement : I am embedding Google map in a web page but I am getting  ApiNotActivatedMapError error for some reason. 

Solution:

Go to console.cloud.google.com and follow the following steps:

1) APIs & Services

2) Dashboard

3) + Enable APIS and Services

4) Maps JavaScript API

5) hit Enable button


Sunday, April 19, 2020

How to get an offline version of Visual Studio 2019 ?

How to get an offline version of Visual Studio 2019? Or simply, is it possible to have an offline version of Visual Studio 2019?

Answer: Yes, It's possible; and the solution is provided by Microsoft itself in this Link.

Why do i need an Offline Installer?


Answer - With an Offline Installer, i can install visual Studio; just by clicking the Setup.EXE executable file.  


How can I get this offline installer?

Answer: Here, we will highlight Visual Studio Enterprise 2019 for Windows 10; however the same process should work for Windows 8.1 and Windows 7.

This is a 2-Step process

Step 1. Download the Visual Studio bootstrapper file   

Download the Visual Studio bootstrapper file for your chosen edition of Visual Studio. 

Edition
Bootstrapper File Link
Visual Studio Community  
Visual Studio Professional 
Visual Studio Enterprise 

Step 2. Create a local install cache


Ø  Open Command Prompt in Administrator mode
Ø  To create a complete local layout with all features, run:
§  vs_enterprise__2132243952.1587278346.exe --layout c:\vslayout --lang en-US

Ø  For .NET web and .NET desktop development, run:
§  vs_enterprise__2132243952.1587278346.exe --layout c:\vslayout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Component.GitHub.VisualStudio --includeOptional --lang en-US

Ø  For .NET desktop and Office development, run:
§  vs_enterprise__2132243952.1587278346.exe --layout c:\vslayout --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.Office --includeOptional --lang en-US

Ø  For C++ desktop development, run:
§  vs_enterprise__2132243952.1587278346.exe --layout c:\vslayout --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US


Thursday, December 31, 2015

ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine" - RESOLUTION

Scenario:

ERROR - "the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine"

RESOLUTION :

There are lot of scenarios for which we might get "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine" error when attempting to connect to either an accdb or an xlsx file. 

I have spent a couple of hours searching Google for a resolution of this issue but somehow I was not getting the correct solution. Ultimately, the below solution worked best for me 100%.

Step 2. in VS, add references (say Microsoft.Office.Interop.Excel)  and write necessary business logic. 
Hope this helps.. Cheers... :)



Wednesday, December 30, 2015

Check-box 'Prefer 32-bit' disabled in Visual Studio 2012. Why?

Question: 

Check-box 'Prefer 32-bit' disabled in Visual Studio 2012. Why?

Answer: 


In Visual Studio, Switch the project to .NET 4.5 (on the Build tab of the project properties). This would re-enable the check-box "Prefer 32 bit" for AnyCPU.

Monday, July 6, 2015

Import Microsoft Access .accdb File to MS SQL Server

Steps to Import Microsoft Access .accdb File to MS SQL Server

  1. Open MS SQL Server Import and Export Wizard.
  2. For “Data Source” choose “Microsoft Office 12.0 Access Database Engine OLE DB Provider”.
  3. Click “Properties” enter the location of the .accdb file in the “Data Source” field.
  4. Under login information, choose a blank username and be sure to check “Blank Password”.
  5. Test the connection. If it works, click OK.
  6. For the “Data Destination” choose “Microsoft OLE DB Provider for SQL Server”.
  7. Enter the MS SQL server name or choose from the dropdown menu.
  8. Enter your SQL credentials and select the database you wish to import the data to, the database should show up in the dropdown menu if your MS SQL info is correct.
  9. Select “Copy data from one or more tables or views”.
  10. Select the tables you want copied and edit the mappings if needed.
  11. Continue through the wizard and hit finish to begin the import.

Ref : http://serversideguy.com/2014/02/05/import-microsoft-access-accdb-file-to-ms-sql-server/ 


Friday, July 3, 2015

The page you are requesting cannot be served because of the extension configuration

Scenario:

I was getting the below error message when trying to run my application having .svc file. 

HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Screenshot of the error page: 

alt text

Solution 1:

Please follow the below two steps on IIS 8.0.
Step 1. Add new MIME type 
  1. Extension: .svc, MIME type: application/octet-stream
Step 2: Add new HttpHandler

  1. Request path: *.svc, Type: System.ServiceModel.Activation.HttpHandler, Name: svc-Integrated
Step 3: Restart IIS

Solution 2:

In Windows 7 and earlier, run aspnet_regiis -i 
Note: but this command seems to have been deprecated in Windows 8 yielding response This option is not supported on this version of the operating system. (...).



Friday, June 26, 2015

SQL server - Intellisense not showing the DB Objects (say, Table names) in Query Analyzer Window

Problem Scenario 1:

I was attempting to create a Stored Procedure in my database. However, the SSMS intellisense does not recognize lot of the tables which exists in the database.
Problem Scenario 2:

While writing the select queries, the Intellisense does not work as expected and is not showing the DB Objects (say, Table names) in Query Analyzer Window

Solution:

Try:
Edit -> IntelliSense -> Refresh Local Cache
This should refresh the data cached by Intellisense to provide typeahead support and pre-execution error detection.

Note: Pressing Ctrl + Shift + R refreshes intellisense in management studio 2008 as well.

Once we create a new SQL Server object, the newly created object does not get updated in the IntelliSence Local Cache and due to this, it shows red line underneath that object. So we need to refresh SSMS IntelliSence Local Cache and once we refresh it, IntelliSence will automatically add newly created object in the cache and the red line will disappear. 
Try this
Edit -> IntelliSense -> Refresh Local Cache 
or
Ctrl + Shift + R 


enter image description here

Ref URL: http://stackoverflow.com/questions/1362531/sql-server-invalid-object-name-but-tables-are-listed-in-ssms-tables-list 


Monday, May 18, 2015

ASP.NET MVC View Model / Model not binding on HTTP Post

Problem Scenario:

I am having an issue that when I post to a controller, I loose model binding and everything in my model is NULL. Here is the code that I am using:
View:

@model Models.StateDTO
@using (Html.BeginForm("AddState", "Home",new {area="Admin" }, FormMethod.Post))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)


State Name



@Html.TextBoxFor(m => m.State)
@Html.ValidationMessageFor(m => m.State)





}

Model:

public class StateDTO
    {        
        public int Id { get; set; }
  
        [Required]
        public string State { get; set; }      
    }

Controller:

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult AddState(StateDTO state)
        {
            if (state != null && ModelState.IsValid)
            {
                //.....
            }
            return View();
        }

Why is everything in my model (i.e. StateDTO state) NULL?

Solution:

One possible reason for view model is NULL :
·         The name of model in action parameter be the same as one of view model's properties

Ex: Here, same name means case insensitive (State is same as state)

Hence, the correct controller action method should be like below:

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult AddState(StateDTO vwState)
        {
            if (vwState != null && ModelState.IsValid)
            {
                //.....
            }
            return View();
        }

Here, "State" property name in model is different then action parameter i.e."vwState"

Hope this helps... Cheers :)


Saturday, May 16, 2015

XBAP Application : How to Configure Visual Studio 2013 to Debug a XAML Browser Application

Scenario:

XBAP Applications does not open in browser when run using Visual studio 2013. Instead, this gives download option..


Solution:


XAML browser applications (XBAPs) run within a partial-trust security sandbox that is restricted to the Internet zone set of permissions.

So, we need to configure Visual Studio to run the XBAP applications in browser..


Steps to configure:



To configure Microsoft Visual Studio to debug an XBAP :
  1. With a project selected in Solution Explorer, on the Project menu, click Properties.
  2. In the Project Designer, click the Debug tab.
  3. In the Start Action section, select Start external program and enter the following:
    C:\WINDOWS\System32\PresentationHost.exe
  4. In the Start Options section, enter the following into the Command line arguments text box:
    -debug filename
    The filename value for the -debug parameter is the .xbap filename; for example:
    -debug c:\example.xbap
Reference: https://msdn.microsoft.com/en-us/library/bb613597(v=vs.110).aspx 

Tuesday, April 28, 2015

IIS - Unable to start debugging on the web server. The address is not valid for this context

Issue:

I was unable to start debugging of web server or attach to process due of error:

Unable to start debugging on the web server. The address is not valid for this context.

Resolution:

I figure out that I need to Enable 32-Bit Applications in Application Pool settings:


Sunday, April 26, 2015

IIS 7.5 : HTTP Error 500.21 - Internal Server Error - Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

Solution:


This is is because ASP.Net was not completely installed with IIS. 
To fix this, simply run the following command at the command prompt
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
If I had been on a 32 bit system, it would have looked like the following:
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i
Once this has been done, Restart IIS and run the web application. 




Friday, April 3, 2015

WCF REST Service Hosting Error : HTTP Error 500.21 - Internal Server Error


HTTP Error 500.21 - Internal Server Error
Handler "svc-Integrated" has a bad module "ManagedPipelineHandler" in its module list in IIS 7.5



Solution:

If you see this error you haven't installed the prerequisites for ASP.NET 4.

Try this:

Step 1. Open Visual Studio Command Prompt
Step 2. Type the following: aspnet_regiis.exe -i
Step 3. Run the command
Try your service again... it should be working :-)

This command basically installs the necessary ASP pieces to get your service up and working!

Sunday, September 14, 2014

Entity Framework 5 to 6 Conversion Error - Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

Problem scenario:

Entity Framework 5 to 6 Conversion Error - Cannot implicitly convert type 'System.Data.EntityState' to 'System.Data.Entity.EntityState'. An explicit conversion exists (are you missing a cast?)

Solution:

When you are using EF 6 or moving from EF 5 to EF 6, you should use System.Data.Entity.EntityState instead of System.Data.EntityState. This error happens when your project has reference to EF6 but you have code for EF5.

Sample Code in EF6

public virtual void Update(T entity)
{
   dbSet.Attach(entity);
   _unitOfWork.Db.Entry(entity).State = System.Data.Entity.EntityState.Modified;
   this._unitOfWork.Db.SaveChanges();
}

Monday, September 1, 2014

Hosting or deploying existing ASP.Net Web Application on Linux


Question: Will a .NET web application be able to run in a Linux based server? 

Yes, it is possible. The below URLs explains these possibilities. 

1. Achieve this functionality using GrassHopper tool:

2. You might also want to consider the below guide that helps Windows developers port their code to Mono/Linux:



Friday, August 22, 2014

HTTP (Hypertext Transfer Protocol)

HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text, graphic images, sound, video, and other multimedia files) on the World Wide Web.

Web browser is an HTTP client, sending requests to server machines. As soon as a Web user opens their Web browser, the user is indirectly making use of HTTP. When we browse a web site using any browser (say Internet Explorer, Google Chrome, Mozilla Firefox etc.), all our actions produces HTTP requests; which are sent to the web server. Web Server replies to each of these requests. The browser uses these server responses/replies to build each page that web user see in its browser window. Some of the responses contain page text in form of HTML code, some contain images that we see on the page, and some carry additional data that is also used to display the page correctly.

Each HTTP request consists of 3 sections: request, header and body.

HTTP Methods

Two commonly used HTTP methods are GET and POST.
·      A GET-request is used to download a resource (page, image, etc.) from the server. GET-method requests data from a specified resource.
·      POST-requests are used to pass some data to the server. They can contain form data, a file that needs to be uploaded, etc. The POST-method submits data to be processed to a specified resource.

Both GET and POST requests can contain parameters. Each parameter has a name and a value; different ones are separated by “&”.

For GET-requests parameters are passed inside the URI after the “?” sign.
GET URL example:
http://my_uri/page.aspx?parameter_name1=value1&parameter_name2=value2 

If POST method is used, parameters are passed inside the request body.

Sunday, October 6, 2013

HTTP Error 403.14 - Forbidden - the web server is configured to not list the contents of this directory

Scenario:

In WCF, I was receiving the below error while trying to run the WCF client application.

HTTP Error 403.14 - Forbidden - the web server is configured to not list the contents of this directory

Solution:


Adding the below lines within the WCF Client application's web.config file, I could finally get rid of the issue and I could run the client application successfully..



VS Code # Warning - npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead

Error : VS Code - NPM Warning - npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead Solution:  Foll...