DotNetOpenAuth and Windows Azure with MVC3 Web Role - azure

I have created a cloud project with an MVC3 webrole (empty project, added homecontroller and view). When I debug(F5) it runs smoothly.
After installing DotNetOpenAuth 3.4.7.11121 via NuGet I get the following error:
Windows Azure Tools for Microsoft Visual Studio There was an error
attaching the debugger to the IIS worker process for URL
'http://127.255.0.1:83/' for role instance
'deployment16(82).WindowsAzureProject1.MvcWebRole1_IN_0'. Unable to
start debugging on the web server. See help for common configuration
errors. Running the web page outside of the debugger may provide
further information. Make sure the server is operating correctly.
Verify there are no syntax errors in web.config by doing a Debug.Start
Without Debugging. You may also want to refer to the ASP.NET and ATL
Server debugging topic in the online documentation.
Same thing happens on an MVC2 project on another machine.
Boils down to the following line of configSections in web.config (added by install-package DotNetOpenAuth)
<section name="uri" type="System.Configuration.UriSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
What am I missing?
Seems like the mentioned line above from web.config can be deleted. Probably already included in machine.config or something.
And, when i hit debug on the mvc project it runs as expected. The error only happens when i debug the cloud project

Seems like deleting the mentioned line (section name="uri"...) fixes things in both debug and without debug.
I have not discovered any ill effects and logon with OpenID against Google with dotNetOpenAuth works.

Related

Asp.Net Core 2.0 on Azure results in a 502.5

I have a small web app developed with Asp.Net Core 1.1 deployed on Azure and it works well. I just migrated the project to use Asp.Net Core 2.0 and tried to deploy it on Azure. The deployment went fine but when I open the site, I get a 502.5 error. When I check my Azure log stream, I get the following error:
This error occurs when a CGI application does not return a valid set
of HTTP headers, or when a proxy or gateway was unable to send the
request to a parent gateway. You may need to get a network trace or
contact the proxy server administrator, if it is not a CGI problem.
Useless to say that it works well on my development machine with the same code. Note that I'm also using Entity Framework Core 2.0 although I deactivated the database creation on Azure (to check if it was not the cause).
For information, the way I migrated from 1.1 to 2.0 is by changing the target framework settings to "netcoreapp2.0" and by using the NuGet package "Microsoft.AspNetCore.All". Just to be sure, I also deleted my publish profile and recreate one.
Is it possible that Asp.Net Core 2.0 is not yet available on Azure ? I'm fairly new to Asp.Net Core, so I don't know when new releases are made available on Azure.
EDIT
When I try to run my app with dot net CLI via the debug console as proposed by natemcmaster, I got the following issue:
Unhandled Exception: System.IO.FileLoadException: Could not load file
or assembly 'Microsoft.AspNetCore.Hosting.Abstractions,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
The located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)
I downloaded the DLL on my desktop and check the version with Dot Net Peak and indeed, the DLL is 1.1.2, although I created the project with Visual Studio and directly publish it, so is it an issue with Visual Studio ? Or Nuget ?
the issue was actually coming from the fact that, at first, my web app was using .net core 1.1, which deploys all the DLL in the "wwwroot" folder of the web application. However, with asp.net core 2.0, it does not do that anymore as the DLL are picked up from a global store. However, as Visual Studio does not clean the destination folder before a publish, I ended up with a situation where the 1.1 DLL were in my wwwroot, so the web site was picking up these ones instead of the 2.0 ones in the store folder.
This is explained in more details here: https://github.com/Azure/app-service-announcements-discussions/issues/2#issuecomment-313816550
Others have explained the reason why this is happening. I'd like to provide another – arguably easier – solution to the problem.
Just change the settings so that you remove files that are already on Azure – see below:
Check for log files either in the portal or by remotely accessing D:\home\LogFiles.
Sometimes, the logs won't indicate what is going wrong. Another good way to investigate further is to try launching your ASP.NET Core app from the Debug Console. If you are missing a shared framework version or there is another startup error, this will be more visible from the Debug Console.
Go to
https://(your web site name here).scm.azurewebsites.net/DebugConsole/
Your site will be in D:\home\site\wwwroot. You can launch it by executing:
cd D:\home\site\wwwroot
dotnet MyWebApp.dll
If you app still fails to launch, make sure that D:\home\site\wwwroot\web.config is available and configured to use ASP.NET Core Module. https://learn.microsoft.com/en-us/aspnet/core/hosting/aspnet-core-module
In my case, It was caused by having a space in the Project Name.
I can readily add a space, publish => 502.5.
Remove space, publish => good to go.
Hard to believe but I am duplicating it readily with above.
Also using "Remove Additional Files at Destination" per #Sam's Answer
See https://github.com/Azure/app-service-announcements/issues/14
"The rollout is expected to complete by Friday June 30th."
In my case the issue occurred because AppService at that time supported 2.0.0-preview2-006497 but I had 2.0.0-preview3-006890 installed which was used on build.
So I added global.json to use preview 2 SDK and it worked then
I don't know if this could help someone one day but in my case, I was using :
-Microsoft.AspNetCore.All 2.0.5
Downdrage to Microsoft.AspNetCore.All 2.0.3 resolve my problem
This happens when your version of ASP.NET Core cannot be matched on the server.
The simplest solution is to change your settings to deploy the app as self-contained, so it doesn't matter if Azure can match the framework version. Also, delete the files already on Azure, so you don't have issues when upgrading, as explained by #Sam.

Not able to setup Umbraco in Visual Studio 2012

I am trying to setup Umbraco in Visual Studio 2012 with Nuget package. After package installation when I try to run it getting following exception.
Type is not resolved for member 'Umbraco.Core.Security.UmbracoBackOfficeIdentity,Umbraco.Core, Version=1.0.5261.28127, Culture=neutral, PublicKeyToken=null'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.Serialization.SerializationException: Type is not resolved for member 'Umbraco.Core.Security.UmbracoBackOfficeIdentity,Umbraco.Core, Version=1.0.5261.28127, Culture=neutral, PublicKeyToken=null'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
I don't recommend using nuget for Umbraco. Using a CMS like that, you won't want to update through nuget once you're in production. Best keep it manually. Here is a step by step to get setup in VS with Umbraco.
Open Visual Studio, create a new "ASP.NET Empty Web Application", with a folder for the solution. Here is how I set it up:
C:\_Websites\[MyProject] --> All this in source control
C:\_Websites\[MyProject]\Website --> .sln file is here
C:\_Websites\[MyProject]\Website\[MyProject] --> .csproj and /bin are here
Download the version of Umbraco you want from here: http://our.umbraco.org/download
Unzip that folder and place it in that [MyProject] folder
Once this is in place, setup your hosts file 127.0.0.1 myproject.local
Setup a new website in IIS, set the binding, make sure the app. pool is using framework 4
Back in Visual Studio, click Show All Files in the Solution explorer and refresh. Include everything in your project.
Build solution and run the website using myproject.local, should be good to go!
I like this setup because Umbraco is developer oriented and this way I control everything. I have to add the references I need manually and this makes me more familiar with the platform as I work with it.
I know I'm not helping you with you problem directly, but this is the setup I use and I never have issues with this. Hope this helps!
I had the same issue when using VS Development Server - try running the program as administrator after selecting "Local IIS Web Server" in the Web section your project properties as explained here.

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel

I'm running my Web Project in IIS.
It is a 4.0 Framework APP.
I have a Service.svc and I get this error when I run my Application.
"Could not load type 'System.ServiceModel.Activation.HttpModule' from
assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'"
I tried this --> aspnet_regiis.exe -iru which I found in a lot of forums and it didn't solve my problem.
Does anyone know another method ?
Try with
c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru
When multiple versions of the .NET Framework are executing side-by-side on a single computer, the ASP.NET ISAPI version mapped to an ASP.NET application determines which version of the common language runtime (CLR) is used for the application.
Above command will Installs the version of ASP.NET that is associated with Aspnet_regiis.exe and only registers ASP.NET in IIS.
https://support.microsoft.com/en-us/help/2015129/error-message-after-you-install-the--net-framework-4-0-could-not-load
I have Windows 8 installed on my machine, and the aspnet_regiis.exe tool did not worked for me either.
The solution that worked for me is posted on this link, on the answer by Neha: System.ServiceModel.Activation.HttpModule error
Everywhere the problem to this solution was mentioned as re-registering aspNet by using aspnet_regiis.exe. But this did not work for me.
Though this is a valid solution (as explained beautifully here)
but it did not work with Windows 8.
For Windows 8 you need to Windows features and enable everything under ".Net Framework 3.5" and ".Net Framework 4.5 Advanced Services".
Thanks Neha
Hello Thanks for the question;
To resolve: "Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'"
In Windows Features check all for .NET 4 Advanced Services & .NET 3.5
Just like Nicolas Gago I tried aspnet_regiis.exe -iru but it didn't work. After the features were on then it yellow screen error was gone. Thanks;
You can install these features on windows server 2012 with powershell using the following commands:
Install-WindowsFeature -Name NET-Framework-Features -IncludeAllSubFeature
Install-WindowsFeature -Name NET-WCF-HTTP-Activation45 -IncludeAllSubFeature
You can get a list of features with the following command:
Get-WindowsFeature | Format-Table
Ok, finally got it.
Change this line in %windir%\System32\inetsrv\Config\ApplicationHost.config
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
To
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />
If this is not enough
Add this following line to the Web.config
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
From the Server Manager's Features node, you can also remove some of the sub-items under the .NET Framework 3.5.1 Features that are installed by the activation of some of the other roles.
For instance, removed the WCF Activation Features as follows and our websites came back:
[x] .NET Framework 3.5.1 Features
[x] .NET Framework 3.5.1
[ ] WCF Activation
[ ] HTTP Activation
[ ] Non-HTTP Activation
Note: this did not require a restart for us.
In Windows server 2012. Go to ISS -> Modules -> Remove the ServiceModel3-0.
Details
http://msdn.microsoft.com/en-us/library/hh169179(v=nav.71).aspx
"This error can occur when there are multiple versions of the .NET Framework on the computer that is running IIS..."
I got this error after I accidentally published one website into the directory of another website. The two websites had different versions of .net. What fixed it for me was changing the application pool. To do that, in the IIS manager:
click the website => Advanced Settings... (on the right) => click to the right of Application Pool => a button with "..." should appear => select ".NET v4.5 Classic"
If that application pool doesn't work, try some of the others.
We are using a web service along side a web site and when we publish the web site it returns same this error. We found out that by going into IIS and removing the ServiceModel from Modules and the svc-Integrated from the Handler Mappings the error went away.
I am late, hope it will help someone ....This is a known issue with IIS 8.0
The solution is to delete the 3.x module and handler from IIS manager. You could delete them at the application or site level if you want to keep them in applicationHost.config. But I wanted to delete them from applicationHost.config. do the following steps:
In IIS manager, click the machine name node.
In “Features View”, double-click “Modules”.
Find “ServiceModel” and remove it.
Image 1 for Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’
Go back to the machine name node’s “Features View”, double-click “Handler Mappings”.
Find “svc-Integrated” and remove it.
Image 2 for Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’
You might changed the IIS features settings.The easy steps to resolve by open command prompt with run as administrator(For Windows Server 2008) and run the command
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru
this will set up ASP.Net 4.0 ,Then Reset the IIS by the command
iisreset
References:
https://support.plesk.com/hc/en-us/articles/213392249-ASP-website-shows-error-Could-not-load-type-System-ServiceModel-Activation-HttpModule-from-assembly
This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has some tags that are not compatible with the .NET Framework 4.0.
Based on your environment, you have 4 workarounds to solve this issue:
Updating Applicationhost.config.
Perform ASP.NET IIS Registration.
Turn on the Named Pipe Activation feature.
Remove ServiceModel 3.0 from IIS
Check the detailed steps for each woraround at Solving Could not load type system.servicemodel.activation.httpmodule from assembly System.ServiceModel
delete the module which is identified in .Net error message , 1 down vote
In Windows server 2012. Go to ISS -> Modules -> Remove the ServiceModel3-0. (without number worked for me)
start-> Run--> c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -iru

RIA Services Web.config default configuration

When I install RIA Services with NuGet (Version 4.1.60730), the default Web.config registeres the domain service module under both and .
This works fine with the development server in Visual Studio 2010, but the standard configuration of the full IIS complains about the setting being incorrect for integrated pipeline mode.
Commenting out the registration under system.web fixes the issue there, but then it won't run under the development server.
Is there a configuration that works in both cases? If not, how to go around this problem?
I know I could install RIA Services system-wide, but I'd like to move away from that.
There is an option to disable the complaint about spurious entries in system.web. Put
<validation validateIntegratedModeConfiguration="false" />
in system.webServer.

Azure - error on starting with multiple web role projects

If I have more than one webroles(projects, not instances) in my application, I get this error: (I only get it if I attach a web role. It works fine wit as many worker roles projects as I want)
Microsoft Visual Studio
Windows Azure Tools for Microsoft Visual Studio
There was an error attaching the debugger to the IIS worker process for URL 'http://127.0.0.1:5100/' for role instance 'deployment(21).CloudPOC.WebRoleToHostDataService.0'. Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.
Click Help for more information.
OK
What is wrong here? I can't understand it and I need a webservice project!
Make sure you are starting the Azure project rather than the Web Project itself. You might have set the Web Role as the startup project, and if you do that you'll find that IIS runs the Web App rather than the Azure Dev Fabric, meaning any Dev Fabric specific stuff (like config settings per role) aren't available causing problems.
What you're meant to do is let the Azure Dev Fabric (Compute Simulator) fire up all your roles for you, and it'll also work out if it needs to open a web browser etc.
So right click on the Azure Cloud project, set that as the Startup Project, and try again.
Hope that helps,
Andy
EDIT thought of something else!
Make sure your web.config is compiling to allow debug="true". If you have added a new WebSite to your solution, it won't be so by default:
<system.web>
<compilation debug="true" targetFramework="4.0" />
I had similar issue which got resolved with following steps.
Make sure you have correct version of .net framework 4.0 is intalled. (.Net Framework 4.0.30319 is the latest version)
Uninstall if there isany other .Net 4.0 framework in present on your system by going to Add And Remove programs.
Go to %windir%\Microsoft.NET\Framework64 physical location and remove unwanted .Net framework 4.0 folder
I've also had this problem and it happened when I upgraded my app to 4.0... I ran without debugging and got the following error:
There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined
and after researching that error, I found this:
http://forums.asp.net/t/1571308.aspx/1
which says there's currently a bug w/ vs2010 and 4.0... I took the answers recommendation and commented out the extensions section and it worked for me... Another possible solution.

Resources