Friday, January 14, 2022

SOLVED - Error "The build failed" - "An error occurred in the tool" on Microsoft WCF Web Service Reference Provider

 In this tutorial we'll learn how to fix the error "The build failed" - "An error occurred in the tool" on Microsoft WCF Web Service Reference Provider.  

We'll use the  Microsoft WCF Web Service Reference Provider tool for refreshing endpoints data on a  WCF application .
Every time something changes on  the service, the consumer application has to refresh its Connected Services references.
However, the following error could happen without previous record, avoiding you to refresh the WCF references:  





Step by step how to fix the error "The build failed" - "An error occurred in the tool" on Microsoft WCF Web Service Reference Provider


You want to refresh the WCF service reference on your project, as follows:


But you are confronted with the following error:


The error message "The build failed" could be misunderstood: my project is building correctly, hence, what is failing to build?

The WCF Web Service Reference Provider tool  creates two projects in a temp folder, and these projects are the ones failing to build.
These projects are stored in the following folder:
%localappdata%\Temp\WCFConnectedService

Opening the folder corresponding to the current time and date, check the bootstrapper project, opening it with Visual Studio:



After you open the project, try to build it. You will get the following errors:



Indeed, this is the project which "The build failed".
Opening the project Properties, you see that there is not "Target Framework" asigned to the project:



After you select from the list the correponding target framework, try to recompile it, to see that this time the build has succeded.

And this gives us a hint of what happened here: because of an internal bug of the tool inside Visual Studio, the correct framework has been mismatched.
To see this clearly, open the folder of your project on Explorer, and type "CMD" on the address. The command line interface CLI  - (a.k.a. CMD Prompt window) , will open.
Then type :
dotnet --version

This will tell you what is the version of Dotnet being used.
And you'll see that is not the same version used by your project.

The problem here is, the WCF tool is using the global dotnet version , instead of the framework used by your project.
Probably, after the creation of your project, you have installed additional .NET SDKs, and now the tool is taking the latest of them into account, instead of the one corresponding to your project.

To fix this, change the dotnet version used by the tool , as follows:

1) Type on the CLI this command, which will allow you to see all dotnet sdks installed on your machine:
     dotnet --info

Select the one matching the framework used by your project.

2) On the same command line interface that you opened before, (i.e. the folder of your project), type the following in order to change the version locally:
dotnet new globaljson --sdk-version X.X.XXX  ( for example : 2.2.110)

Where X.X.XXX is the version that you selected before.

3) Type again dotnet --version, to see the changes.

4) Run again the WCF Web Service Reference Provider tool. This time your references will be refreshed accordingly.

You can try another solution, which is to update your Visual Studio to the latest version, hoping that the issue had been resolved. It will cost you a download of about 4 GIGABYTE of data.
However, the above solution will be straightforward and painless.

That's all.... 
In this tutorial we've seen how to fix the error "The build failed" - "An error occurred in the tool" on Microsoft WCF Web Service Reference Provider. 
Happy programming.....


      By Carmel Shvartzman
כתב: כרמל שוורצמן



Friday, June 11, 2021

SOLVED - Error " there is no package called ‘bslib’ " on Heroku deployment from GitHub repository

In this tutorial we'll learn how to solve the  error " there is no package called ‘bslib’ " on Heroku deployment from GitHub repository  

This error occurs while deploying an app to Heroku from a GitHub repository . Your app works perfectly on your development machine, but it would fail on deployment, like this :


Step by step how to  solve the error " there is no package called ‘bslib’ " on Heroku deployment from GitHub repository  


First of all, notice that it seems to be an ENCODING problem : something does not look good with these symbols :  " â€˜bslib’ "

So probably you just have been trying of changing the encoding for your files, also at your machine or uploading again the files to your repository at GitHub.

However, nothing seems to help.

But if you take a closer look, the error states "...NO package called..."  : the PACKAGES are not there.

And inside the word  â€˜bslib’  you can realise the name of the unknown package .

So check whether you are loading this package :



In case you are not loading it, just add it to the setup installations : 



So, redeploy and take a look again: the app is now working:






That's all.... 
In this tutorial we've seen how to solve the  error " there is no package called ‘bslib’ " on Heroku deployment from GitHub repository  .
Happy programming.....
      By Carmel Shvartzman

כתב: כרמל שוורצמן









Wednesday, March 17, 2021

SOLVED - How to fix the Azure error "You do not have permission to view this directory or page" while deploying .NET Core 3.1 Angular Web App

  In this article we review how to fix the Azure error "You do not have permission to view this directory or page" while deploying .NET Core 3.1 Angular Web App  using Angular 9/10,  looking like this :




SOLVED - How to fix the Azure error "You do not have permission to view this directory or page" while deploying .NET Core 3.1 Angular Web App




This error message is quite misleading, since you do have all permissions to enter your own website, of which you are the administrator:


In order to see the error logs, on the AZURE dashboard, search for the App Service Logs:


And switch on all logs. Next, open the Log Streams to see the logs:






Next, search for the KUDU console, to open the KUDU web site and see what's going on with your site:






Press on "Go":








Also, you can open KUDU by typing https://<your app name>.scm.azurewebsites.net/DebugConsole.




After KUDU will open, open the Debug Console:


Here you can check whether everything is fine with your web site, especially if the wwwroot contains your files or if the hierarchy of the web site is incorrect.

The problem with the hierarchy of the site, is that the "Deploy to Web App..." of the Azure Extension may not deploy adequately your site. 

You probably selected your PUBLISH folder to deploy:



But instead, Azure deployed a PARENT folder ("bin\release"), therefore the integrity of your Azure web site will remain corrupted:




To solve this, open the Azure App Service extension, and open its settings:





There, change the PATH of the deployed folder:





The path MUST point to "Publish" :







You can also uncheck the Deploy Confirmation there:




Now deploy again your website:





Open Azure's KUDU, and you'll see the hierarchy fixed : 




Your Azure's website should be working by now!!!


That's All!!! In this tutorial we saw how to fix the Azure error "You do not have permission to view this directory or page" while deploying .NET Core 3.1 Angular Web App  using Angular 9/10.
Enjoy .NET Core .....

      by Carmel Schvartzman

כתב: כרמל שוורצמן

Wednesday, September 2, 2020

SOLVED - IIS Asp.Net Core Error "500.31 ANCM Failed to Find Native Dependencies"

 In this tutorial we'll learn how to solve the IIS Asp.Net Core Error "500.31 ANCM Failed to Find Native Dependencies"  

This error ocurrs while deploying an Asp.Net Core app to IIS .

First of all, search for the ERROR CODE on the Troubleshoot ASP.NET Core  :



Step by step how to  solve the IIS Asp.Net Core Error "500.31 ANCM Failed to Find Native Dependencies" 

You'll find there that the .NET Core runtime in-process fails to start. OK.

So may be the Microsoft.NETCore.App or Microsoft.AspNetCore.App runtime isn't installed?

Check the "Modules" tab on your app on IIS . 

However, the Modules are there :



The cause stated at the troubleshoot, is that the version does not exists on the machine:




So, search for the download link on the following url :  Publish an ASP.NET Core app to IIS



Below the title "Install the .NET Core Hosting Bundle" , you'll find the download link :  

Current .NET Core Hosting Bundle installer (direct download)



Download it, and copy it to the machine where the IIS is installed:

Run it as Administrator, and RESTART IIS after the setup is finished (my website >>> STOP >>> START (or RECICLE)) :


That's all.... 
In this tutorial we've seen how to  solve the IIS Asp.Net Core Error "500.31 ANCM Failed to Find Native Dependencies. 
Happy programming.....
      By Carmel Shvartzman

כתב: כרמל שוורצמן










Saturday, August 1, 2020

How to install SAP Crystal Reports for using in Asp.Net

In this tutorial we'll learn How to install SAP Crystal Reports for using in Asp.Net  
However straightforward , the installation can be a bit trickier since the wizard won't let you install until you close ALL Microsoft applications, and it will give you a PROCESS ID of the software to close, which you will have to find for yourself , showing the following dialog :







Step by step  How to install SAP Crystal Reports for   using in Asp.Net



First, go to the    Download SAP Crystal Reports, developer version for Microsoft Visual Studio web page , and download the version that you need.
Then, start the setup as follows:













Now, as stated before,  the wizard won't let you install until you close ALL Microsoft applications, and at first it will give you the names of the software to close:



 You will need to open the Task Manager (ctl-alt-del) and close them manually :








But that is not all.  After that, the wizard won't let you continue the setup until you close ALL Microsoft applications, and it will give you a PROCESS ID of the software to close, which you will have to find for yourself , showing the following dialog:


Therefore, at the Task Manager, you will have to change the settings in order to display the PID Process Identifier of all programs running :



Only after that, you could find the PID of the processes to close :


That's all.... 
In this tutorial we've seen How to install SAP Crystal Reports for using in Asp.Net. 
In the next tutorial     Step by Step How to Add a SAP Crystal Report to an Asp.Net project     we'll see how to add the SAP Crystal Reports for using in Asp.Net.
Happy programming.....
      By Carmel Shvartzman
כתב: כרמל שוורצמן











Saturday, July 11, 2020

Querying Entities' Properties in Web API OData RESTful with ODataController

In this article we enable the Querying of an Entity's Property in an Web API OData RESTful service with ODataController.
Our task here is to perform OData protocol queries in order to get the value of some Entity's property, the following query for example :
http://localhost:6954/Odata/Notes(10)/Body/$value


When developing an ODataController to create an OData Web API, having configurated the application properly, as in the previous tutorial, you get automatically support for the most common OData protocol's queries. You can then query the OData Web API using $metadata, $value, $select, $top, $skip, $filter and even $expand , to get the JSON response:
http://localhost:6954/OData/$metadata#Notes :

              /Odata/Notes?$filter=From eq 'Fry'





http://localhost:6954/OData/Notes?$skip=2&$top=10

http://localhost:6954/OData/Notes?$select=Body

There are some conventions to follow when developing an ODataController:

1) the controller's name must be the entity name, the root of the resource path:

      /Notes(10)      implies that the Web API will look for a controller named NotesController (case sensitive)

2) the Action name for fetching an Entity's property will be set according to the Entity type and the Property name, as follows:

  /Notes(10)/Body       
      means that the Web API will look for an Action method named GetBodyFromNote()

All this conventions can be found in the Microsoft Asp.Net official site.
Let's say we have an Entity named "Note" with some property called "Body" : we want to call the OData HTTP service with this URI:
      http://localhost:6954/Odata/Notes(10)/Body/

So, according to the OData protocol specification, we need an Action method named GetBodyFromNote(), marked with the attribute "[EnableQuery]" , which returns the required property from the Entity:


(COPY-PASTE THIS CODE) : 


 [EnableQuery(AllowedQueryOptions = AllowedQueryOptions.All)]
        public string GetBodyFromNote([FromODataUri]int key)
        {
            IEnumerable<Note> data = Repository.GetAll();
            var note = data.Where(n => n.ID == key) .SingleOrDefault();
            return note.Body ;
        }



Build & run the application, and type the URI to fetch the required property in JSON format:

http://localhost:6954/Odata/Notes(10)/Body/
Also, we can request ONLY the $value of the property:

http://localhost:6954/Odata/Notes(10)/Body/$value
That's all
In this post we've seen how we perform Querying Entities' Properties in Web API OData RESTful with ODataController. 

Enjoy programming.....
    By Carmel Shvartzman
כתב: כרמל שוורצמן