Showing posts with label .NET Core. Show all posts
Showing posts with label .NET Core. Show all posts

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
כתב: כרמל שוורצמן



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

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