ASP.NET MVC 5 / EF 6 : "No connection string named could be found in the application config file." when adding migration - asp.net-mvc-5

I have a solution with two ASP.NET MVC web apps, each having its own connection string. Problem is only with one of these projects which has command interceptor. When I try to add migration to the project, I get this error if it is not set as startup project:
And this one if it is set as startup project:
Both errors occur at line 17 of the KFI_IPPContext.vb file:
When I comment out line 17, migration is added successfully. I have tried copying connection string to other 3 web.config files in my projects (1 in current, 2 in other project) with no luck. Cleaning and rebuilding solution doesn't work either. I know that I can comment / uncomment line for each migration without making any problem in my app, but my question is WHY?!

Related

Blazor .net 5 integrity error on 3 files resource blocked

I have a simple app blazer wasm project in .net 5 hosted in IIS8.5.
The root of the problem seems to be 3 files are having the following error in console:
Failed to find a valid digest in the 'integrity' attribute for resource {offending file here} with a computed SHA-256 integrity [sha-256 number here] the resource has been blocked.
I also get Unknow error occurred while trying to verify integrity.
I have tried cash clearing, and several other remedies. the 3 files are all framework files in _framework, dotnet.wasm, dotnet.timez, icudt_EFIGS.
I tried a fresh boiler plate blazer component project and tried to post it and had the same issue. However a boiler plate ASP.NET Core Web App project seems to work fine
Also, several posts have mentioned startup.cs which my blazer projects do not produce only program.cs. Is there something I do not know about here??
The IIS server hosts rest .net5 and has net 5 hosting package and sdk applied. Also, publishing locally to my IIS produces the same result. However using IISExpress through VS2019 works fine.
I see the Loading... from index.html and get this error in Edge:
enter image description here
Thank you for your consideration.

UserSecretsId prevents any deployment of F# ASP.NET Core app to Azure App Service

I'm trying to deploy my F# ASP.NET Core app to Azure App Service. Unfortunately, each time I try to deploy, a <UserSecretsId> element is added to my project file, which as explained in this article causes the build to fail with the following error:
A function labeled with the 'EntryPointAttribute' attribute must be the last declaration in the last file in the compilation sequence
The article explains why the error occurs and instructs to fix it by removing the element from the project file and instead adding the user secrets ID in an AssemblyInfo.fs. I have tried this and can then build manually, but each time I try to deploy, the deployment process still adds a <UserSecretsId> element with a new ID in my project file, causing the build to fail.
Is there any way I can publish an F# ASP.NET Core app to Azure App Service?
(Also reported on Microsoft/visualfsharp#5549)
Add this to your .fsproj file to suppress the attribute generation.
<PropertyGroup>
 <GenerateUserSecretsAttribute>false</GenerateUserSecretsAttribute>
</PropertyGroup>
If you want to use user secrets, you will manually need to add the UserSecrets assembly attribute.
module Your.Namespace.AssemblyInfo
open Microsoft.Extensions.Configuration.UserSecrets
[<assembly: UserSecretsIdAttribute("Your UserSecretsId")>]
do()
Also, this workaround should be unnecessary in ASP.NET Core 2.2. See https://github.com/aspnet/Configuration/pull/872

Azure Fabric Cluster Error Publishing: Test- ServiceFabricApplicationPackage : It was not poss¡vel Find Part of Path

Everytime i click Publish i receive this error on the output window.
Test- ServiceFabricApplicationPackage : It was not possible to Find Part of Path
Do you perhaps have an ASP.NET 5 project in your application? There is a known issue where file paths for ASP.NET 5 projects included in Service Fabric apps get too long and fail in the Test-ServiceFabricApplicationPackage cmdlet during deployment. We have a fix for this coming in an SDK refresh coming soon. In the interim, the best you can do is to keep the name of your ASP.NET projects very short.

IIS Express Debugging No Longer Working

I'm using IIS Express with Visual Studio 2013 on Windows 8.1 x64 for a WebAPI 2 application (all en-US here). This worked just fine roughly a month ago, but now I'm getting errors when attempting to debug the application.
If I do not run VS as admin (again, didn't need to do this before), I get:
A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Access to the path 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\~AspAccessCheck_c00414062044.tmp' is denied.
A second error occurs after this, or it will be the first error if I run VS as Administrator:
A first chance exception of type 'System.Globalization.CultureNotFoundException' occurred in mscorlib.dll
Additional information: Culture is not supported.
If I run the same WebAPI application from WebMatrix 3, it runs without errors (with or without running 'as Admin').
Project IIS config settings:
<UseIISExpress>true</UseIISExpress>
<IISExpressSSLPort>46435</IISExpressSSLPort>
<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>disabled</IISExpressWindowsAuthentication>
<IISExpressUseClassicPipelineMode>false</IISExpressUseClassicPipelineMode>
I also have the application running on http://localhost:46436.
What I also find really strange is that the project properties show "IIS Express" and to use a URL of http://localhost:46436/, but in the project file I'm seeing:
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>46435</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:46436</IISUrl>
That may explain my access denied. Regardless if I unset, save, and re-set to use IIS Express (storing it for all users), the <UseIIS> property is set back to true.
EDIT: It looks like "Use IIS" is normal. I created a new WebAPI 2 project as a test. It ran fine under IIS Express OOTB.
I also had this issue. Ended up having to right click the folder in question and add access for the IIS_IUSR account.
If this isn't causing critical errors, you can also disable break mode for this sort of issue via Debug -> Options -> Debugging and check Enable Just My Code (Managed Only)
I updated all of the packages via the 'Manage NuGet Packages' console, and it started working.

csproj* Cannot save web project

I have an web project using WebAPI 2 with is compile clean and starts with owin.
So everything seam to be ok, but if i open the project properties their is always a star next to my project settings tab.
I can save it, (File => SaveAll or Ctrl + s) but the star does not disappear.
The resulting problem is that this project cannot be checked in to TFS which shows me an error message that I have to save my project.
This project is migrated from vss but the modification problem occured also before the migration
I fiugred it out:
The problem was, that in .csproj the ProjectTypeGuids tag was surrended with comments
.....</ProjectTypeGuids>-->
After uncomment the line the project can be saved

Resources