Friday, October 20, 2017

VS 2017 Error - Unable to start program http://localhost An operation is not legal

Scenario
You are trying to debug a web site in Visual Studio 2017

Error
Microsoft visual studio is giving the error: Unable to start program http://localhost An operation is not legal


Solution
Disable the JavaScript debugging

  • On VS go to Tools >> Options
  • Go to Debugging >> General
  • Uncheck the option Enable JavaScript debugging for ASP.NET (Chrome and IE)
  • Click OK and try again

Wednesday, October 18, 2017

VS 2017 MVC Core 2.0 error - Cannot find reference assembly 'Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe' file for package Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86

Scenario

After compiling a MVC Core 2.0 project in VS 2017, the browser isn't displaying the site

Error
An unhandled exception occurred while processing the request.

Cannot find reference assembly 'Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe' file for package Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86

Solution
Open the .csproj file in a text editor
In the section set the MvcRazorCompileOnPublish tag as true:
      <mvcrazorcompileonpublish>true</mvcrazorcompileonpublish>

Tuesday, October 17, 2017

VS 2017 MVC Core 2.0 publish fails

Scenario
Publish a MVC Core 2.0 project in Visual Studio 2017

Error
Severity
Error
Code
The command ""bin\Release\net461\Microsoft.AspNetCore.Mvc.Razor.ViewCompilation-x86.exe"
Description
@"obj\Release\net461\microsoft.aspnetcore.mvc.razor.viewcompilation.rsp"" exited with code 1


Solution
Open the .csproj file in a text editor
In the section set the MvcRazorCompileOnPublish tag as false:
      <mvcrazorcompileonpublish>false</mvcrazorcompileonpublish>

Tuesday, October 10, 2017

MVC Core - Duplicate Content Error after Upgrading Visual Studio 2017

Error

  • Dotnet-aspnet-codegenerator-design has stopped working
  • Duplicate 'Content' items were included. The .NET SDK includes 'Content' items from your project directory by default.
  • Failed to build the project. Please fix the build errors and retry again


Reason

The problem is a change on the RC3 release of Visual Studio 2017, if you have globs in your project and you try to build it using the newest SDK, you'll get the error. Basically your content, such as the files in wwwroot are now getting imported by the default includes that are built-in to Visual Studio and by the manual rules in your csproj file.


Solution 1

Open your web project file .csproj and remove the duplicated items specified in the error message


Basically remove the ItemGroup tag with all the wwwroot paths.



Solution 2

Open your web project file .csproj
Look for the tag
Add the next tag false


Friday, September 15, 2017

SSIS Error - The value cannot be converted because of a potential loss of data

Error

[OLE DB Source [167]] Error: There was an error with OLE DB Source.Outputs[OLE DB Source Output].Columns[MyColumn] on OLE DB Source.Outputs[OLE DB Source Output]. The column status returned was: "The value could not be converted because of a potential loss of data.".

Solution

Go into the source component then right clicking on it and choose "Show Advanced editor..."


From the Advance Editor select Input and Output Properties


Expand the OLE DB Source Output
Then expand the Output Columns
Select the column generating the error


O the properties section, scroll to the Length Data Type Property and increase the value to  something like 255.



Friday, June 16, 2017

MVC Core error - HTTP Error 502.5 - Process Failure

If you are deploying your project to Internet Information Services and you get the error below, there are several possible reasons according with microsoft.


Possible reasons:
  • If you published a self-contained application, confirm that you didn’t set a platform in buildOptions of project.json that conflicts with the publishing RID. For example, do not specify a platform of x86 and publish with an RID of win81-x64 (dotnet publish -c Release -r win81-x64). The project will publish without warning or error but fail with the above logged exceptions on the server.
  • Check the processPath attribute on the element in web.config to confirm that it is dotnet for a portable application or .\my_application.exe for a self-contained application. For a portable application, dotnet.exe might not be accessible via the PATH settings. Confirm that C:\Program Files\dotnet\ exists in the System PATH settings.
  • For a portable application, dotnet.exe might not be accessible for the user identity of the Application Pool. Confirm that the AppPool user identity has access to the C:\Program Files\dotnet directory. Confirm that you have correctly referenced the IIS Integration middleware by calling the .UseIISIntegration() method of the application’s WebHostBuilder().
  • If you are using the .UseUrls() extension method when self-hosting with Kestrel, confirm that it is positioned before the .UseIISIntegration() extension method on WebHostBuilder(). .UseIISIntegration() must set the Url for the reverse-proxy when running Kestrel behind IIS and not have its value overridden by .UseUrls().
I got this error, but in my case the problem was I didn't declared the environment variable ASPNETCORE_ENVIRONMENT, so the application wasn't able to get the appsettings..json file; after I added the variable I restarted the server and my site worked just fine.

Monday, June 12, 2017

ASP MVC Error Unable to connect to web server IIS Express

If you get the next error when trying to run your app from visual studio:


You can try different things to fix the problem

- Right click on your project, then select properties, click on the Debug section, assign a new port in the App URL direction



- In explorer go to the path \.vs\config and delete the applicationhost.config, then rebuild your project 



- Open the task manager and stop the IIS Express if is running so you can get a fresh instance


Wednesday, June 7, 2017

.Net Core Installation Error 0x80070003 - The system cannot find the path specified

If you are trying to install .Net Core on your server and you get the error:

.Net Core 1.0.1 VS 2015 Tooling Preview 2 - Installation Error 0x80070003 - The system cannot find the path specified.



That only means the install packages are not complete so we have to completed the installation; to do it follow the next steps:

- Open the command line

- Run the .Net Core installation file with the layout parameter from the command like


- You should get the confirmation message that .Net Core was successfully installed