ASP.NET on mono: System.TypeLoadException - asp.net

I would like to develop a website with ASP and run it on a Ubuntu or Debian server using Mono. To start I have created a very simple application with Visual Studio on Windows and want to deploy it to a Ubuntu box, just to see that it works. But so far it doesn't.
What I have done: I have created an ASP.NET (version 2) application with Visual Studio 2012 on Windows. Then I have published the project to my file system an copied it to the server. It runs Mono version 3.2.8. I have configured a vhost following this instruction: http://devblog.rayonnant.net/2012/11/mvc3-working-in-mono-ubuntu-1210.html.
However, if I open the browser and try to open the website, I get a System.TypeLoadException. It says:
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): <myprojectname>
Needless to say that this error does not occur in the debug environment.
I have been trying to fight this all day but I can't figure it out. Any help will be greatly appreciated.

Related

Visual Studio 2017 throws error on debugging an ASP.NET MVC application

I am setting up my new workstation (Windows 10 Pro) with my ASP.NET projects with Visual Studio 2017. I have enabled local IIS and the project throws a timeout error while trying to debug the project.
It is not failing 100% of the time though, mostly fails but when it runs it is taking longer than expected to give the startup page. The error thrown is
Unable to start debugging on the web server. The operation has timed out
I did notice that the IIS worker process (w3wp.exe) was only executed in the completed console output. So it looks like the IIS worker process is not always being executed.
Any help would be appreciated!
Thank you!
The project runs successfully on an old workstation (Windows 10 Edu) with Visual Studio 2017. App pool settings has been compared between both and it seems same. IIS reset is tried as well. Visual studio has been repaired and IIS local has been restarted as well (unchecking and enabling followed by restarting the machine). Default app pool is used and its been recycled as well. Nothing worked!
Possibly the Visual Studio project version does not match the ASP.NET configured application pool. Update the ASP.NET version in the application pool and restart it.
Make sure you have the correct version of ASP.NET installed on IIS. A version mismatch between ASP.NET in IIS and the Visual Studio project can cause this issue. May need to set the framework version in web.config. To install ASP.NET on IIS, use the Web Platform Installer (WebPI).
If the issue is not related to IIS configuration, try the following steps:
Restart Visual Studio with administrator privileges and try again.
For example, using the Web to deploy some ASP.NET debugging scenarios that require elevated Visual Studio privileges.
If you are running multiple instances of Visual Studio, reopen your project in one instance of Visual Studio (with administrator privileges) and try again.
If using a HOSTS file with a local address, try using the loopback address instead of the computer's IP address.
If not using a local address, make sure the HOSTS file contains the same project URL as in the project properties, Properties > Web > Server or Properties > Debug, depending on the project type.
Reference link:
Visual Studio "Unable to start debugging on the web server. The web server did not respond in a timely manner.".

ASP.NET Core application doesn't work in IIS Express

I develop ASP.NET Core 2.0 application which works on full framework <TargetFramework>net461</TargetFramework>. Ususally to debug it I use IIS Express: just click green arrow in Visual Studio 2017. It worked OK. But today it stopped working properly. Application runs but all requests hang. No exceptions are thrown. In Windows Logs/Application I see this:
Application 'MACHINE/WEBROOT/APPHOST/MY.APP.HERE' with physical root 'C:\code\MY.APP.HERE\' failed to start process with commandline 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\Microsoft\Web Tools\ProjectSystem\VSIISExeLauncher.exe -argFile "C:\Users\Username\AppData\Local\Temp\tmp35D5.tmp"', ErrorCode = '0x80004005 : 0.
Source of the message is IIS Express AspNetCore Module.
Any ideas what's the reason and how to fix it?
UPDATE: I see A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\code\PATH.TO.APP.HERE\bin\Debug\net461\win7-x64\publish\'. whily running dotnet MyApp.exe.
iisreset - try it one time - As it was working before , hope it works !

Error while running asp.net apps in Visual Studio 2015

In my company I'm running Visual Studio 2015 Enterprise and just recently upgraded to Windows 10. Unfortunately, now I can't run any web project using versions of asp.net earlier than 5 (owin/katana) - always getting error :
"Could not load file1or assembly 'XXX' or one of its dependencies.
The process cannot access the file because it is being used by another
process. (Exception from HRESULT: 0x80070020) ".
Now, I've found a few posts like this and the answer is mostly that some other application is running on port 80, 8080 etc blocking visual studio's iis express. The problem is that I get this error regardless of port I'm using (even on some random 34535 etc).
The interesting part is that when I run kestrel (app on asp.net 5) it works and runs fine without any error.
Anyone has any ideas ?
Okay, so I had this issue and resolved it by uninstalling Panda antivirus, which presumably was locking the assemblies for just long enough to interfere with loading them some of the time.
If anyone else is having this issue, and there is definitely an assembly that won't load (as opposed to a port that's already been bound to) then try checking your antivirus!

IIS Default website throws error with .CLR 4.0 System.OutOfMemoryException. 2.0 works fine

I have a Windows 8.1 machine (2GB RAM + 32-bit OS, x64-based processor) and have configured IIS on it. When I try to launch the default website (localhost) which is by default on port 80, it throws the following error:
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Exception of type 'System.OutOfMemoryException' was thrown.
Source Error:
Line 109:
Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web.config Line: 109
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34248
This happens right after the OS installed, updated with Windows Update and IIS configured. Machine is clean and there is no other app, not even an anti-virus installed.
Same this is happening with my other websites as well. Even with a one page 'Hello World' asp.net page.
What works:
When I change the application pool to 2.0, it works fine.
So far:
I have tried resetting permissions C:\Windows\Microsoft.NET\Framework\v4.0.30319
Tried running aspnet_regiis.exe /iru command
Adding features from 'Turn windows features on or off' (Even all of them)
At any point my system has around 800 MB free RAM.
Other Info:
I have a Windows 2012 Server, 2Win 7 machines and 2 windows 8 machines on which my website works fine. This is the last Intel NUC which I'm testing and it's not working. I need to be able to locally host my application on this machine so it can work offline. But as I mentioned, I don't see the issue is with my website since it doesn't work with a single-page website and not even with the default website.
Any help or direction is much appreciated!

MSDEPLOY: How can I access the command generated by Visual Studio

How can I access the MSDEPLOY command line generated by Visual Studio 2010.
I am asking because when I manually run MSDEPLOY I can easly deploy on a remote server and when I run it throught Visual Studio, I get this error
Web deployment task failed.(Remote Agent (url https://x.x.x.x:8172/msdeply.axd?site=Default Web Site) could not be contacted
Make sure the remote agent service is installed and started on the target computer.
An unsupported response was received. The response header 'MSDeploy.Response' was '' but 'v1' was expected
The remote server returned an error:(404) not found
If you follow this guys instructions you can see more verbose output:
http://sedodream.com/2010/11/04/WebDeployHowToSeeTheCommandExecutedInVisualStudioDuringPublish.aspx
FYI, I tested this myself because MSDeploy.exe from the command line was working but the Publish form Visual Studio 2010 wasn't working (using Web Deploy). MSBuild gave me the error messages I needed to fix my issues.
My issues were specifically that the web server I was deploying to did not have .NET 4 installed, and therefore the App Pools were set to 2.0. Visual Studio in all it's greatness says nothing about this, but MSBuild did. After that, I had an ACL issue and had to add another delegation rule in addition to the ones they tell you to add in the intro guides.

Resources