I uploaded my asp.net application through FTP from visual studio, after deploying it is throwing runtime(Parse Error).
I have seen several posts and tried many alternatives but none of them is working:
After uploading, the error was:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details
and modify your source file appropriately.
Parser Error Message: Could not load type 'SimpleEchoBot.WebApiApplication'.
Source Error:
Line 1: <%@ Application CodeBehind="Global.asax.cs"
Inherits="SimpleEchoBot.WebApiApplication" Language="C#" %>
Source File: /global.asax Line: 1
As mentioned in this post: Parser Error Message: Could not load type 'webmarketing', I changed CodeBehind to CodeFile but a new error has been raised stating that asax.cs does not exist!
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.
Parser Error Message: The file '/Global.asax.cs' does not exist.
Source Error:
Line 1: <%@ Application CodeFile="Global.asax.cs"
Inherits="SimpleEchoBot.WebApiApplication" Language="C#" %>
Source File: /global.asax Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET
Version:4.7.3282.0
At the time my plesk file manager looked like this:
And then I uploaded Global.asax.cs file and then this error showed up:
As shown in this post: Parser Error: Server Error in '/' Application I changed Global.asax.cs namespace such that it is equal to the inherits path in asax!
Modified namespace code in asax.cs:
https://i.stack.imgur.com/8VPFs.jpg
code in asax:
<%@ Application CodeBehind="Global.asax.cs" Inherits="SimpleEchoBot.WebApiApplication" Language="C#" %>
but still, the above "This program is blocked by group policy" error is getting raised!
And I deployed the same application to Azure, same parse error, mentioned at the top is showing up!
Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'SimpleEchoBot.WebApiApplication'.
Source Error:
Line 1: <%@ Application CodeBehind="Global.asax.cs" > Inherits="SimpleEchoBot.WebApiApplication" Language="C#" %>
Source File: /global.asax Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.3163.0
Edit: As requested by jessehouwing, here are the Bin folder Screenshots:
As @jeesehouwing comment mentioned, I tried to precompile the website and upload, but while precompiling I received few errors:
System.AggregateException: One or more errors occurred. --->
System.Exception: Publish failed due to build errors. Check the error list
for more details.
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean
includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,
CancellationToken cancellationToken)
at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.
<>c__DisplayClass40_0.<PublishAsync>b__2()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) atSystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)atMicrosoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__88.MoveNext()
---> (Inner Exception #0) System.Exception: Publish failed due to build errors.
Check the error list for more details.<---