The site works fine when I'm running it locally, I published it and hosted to a hosting space hired by my company via SMART FTP.There is a folder with my company's name eg. 'MyCompany'. It has sub folders such as App Data, App Code, Bin, Httpdocs,Httpsdocs...etc. I transferred my published project'UtilityServices' to Httpdocs. Then i enter www.MyCompany.net/UtilityServices/Customer_Login.aspx i got the following error.
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 the assembly 'App_Web_ah9y-lsc'. Make sure that it is compiled before accessing the page.
Source Error:
Line 1: <%# page language="C#" autoeventwireup="true" inherits="Customer_Login, App_Web_ah9y-lsc" %>
Line 2: <%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
Line 3:
Source File: /UtilityServices/Customer_Login.aspx Line: 1
Httpdocs has a bin folder and a webconfig, the hosted UtilityServices has a bin and webconfig. Is this the reason for this error.
I am using VS2008 C# 3.5 Framework.
Well, it is an old question and still many search for a relevant answer to this problem.
You need to change the site to an application in the IIS.
Just open the IIS manager and choose the site which has been compiled. Right click the site and choose "Convert to Application". No need to restart the IIS, but there is no harm if you do that. This will solve the problem.
I've had similar problems when transferring files to a web server - what I presume to be happening is that files somehow get corrupted in transfer, and you get weird assembly names.
What worked for me is, if I could find out what files broke the build on server (if it worked before I uploaded a batch, then I got compile error of this type), I would make minor changes (press space and backspace) to force a save on them, and reupload those files, and in turn that would make server recompile them again and the error would be gone.
Hope this works for you :)
If the app you have in /UtilityServices/ has it's own App_Code folder, etc, then the directory needs to be configured as an Application in IIS. See this link for instructions on how to do this.
If you cannot configure the webserver, try placing the files in your App_Code, bin, etc folders in there corresponding folders at the root of the site.
Related
I just checked out my "mixed" (asp classic and .Net) web site source from SVN on a new Windows 2019 Server. When I go to the logon page (.asp classic), it's fine but when you logon and call the main page (.aspx) it throws the error: "Could not load type 'CADE.main.index'" and displays:
Line 1: <%# Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="CADE.main.index" %>
This SVN code is running on 15+ servers, including one 2019 Server. The code behind looks like:
namespace CADE.main
{
public partial class index : BasePage // Override with BasePage
{
IIS and everything under Application Development is installed. IIS serves .asp, .txt, .gif, .png, even .Net handlers (.ashx) and web services (.asmx), just not the aspx pages.
So, I rebuilt the solution with VS2019 and published it, gave administrator permissions on the app pool, gave "Everyone" full permissions on the entire web, deleted the bin directories in both the source and web locations, ensured output path was bin/, cleaned the project, don't think I should change CodeBehind to CodeFile, and tried about every other thing that people have suggested on this web site but nothing has eliminated the error.
Question: How do I fix this error so the .aspx pages loads?
EDIT #1: 15 hours after post
I'm not sure but with this information maybe this should be a new post.
This error ONLY happens on the second web site. IIS is serving two web sites, separating them by host name (web1.com vs. web2.com) in bindings. They both point at the same file structure. Web1's subdirectories are natural while Web2's subdirectories are virtual directories that point to Web1's.
Web1: Normal IIS web
wwwroot
LMW (subweb, LMW/Main/index.aspx is page in question, but works here)
Web2: Second web in IIS, based on host name, uses Web1's folders as virtual directories.
wwwroot
WEB2 (folder under wwwroot)
LMW (virtual directory points to Web1/wwwroot/LMW. LMW/Main/index.aspx gives the error here)
Question: Why doesn't the .aspx work when it's a virtual directory?... it's the same file as is in Web 1?
EDIT #2
It is working but I don't know what I did to fix it. I'm sure I changed something but I don't know what it was. So, I created another web like web #2, New web folder under wwwroot with LMW a virtual directory pointing to Web1/wwwroot/LMW! I'm seriously missing something, Any ideas?
These errors occur if the .aspx page or the Global.asax page contains a reference to a code-behind module and if the application has not been built.
You could try the below method to build the application:
Use the C# command-line compiler (CSC.exe) to run the following command:
csc /t:library /r:System.web.dll /out:mydll.dll myfile.cs
OR
In Microsoft Visual Studio .NET, click Build on the Build menu.
Also try changing CodeBehind="index.aspx.cs" to CodeFile="index.aspx.cs". This change is required when you change project type from website to webapplication or vice versa.
make sure you install the .ne framework feature of iis.
I actually created a brand new web that used a Virtual Directory for it's codebase that is the same code as the other webs.
Index.aspx resides in the /lmw/main directory. I had created an Application on that folder when I was creating the other applications in the web. So, I removed the "Application" from /lmw/main and it worked.
I have deployed my ASP.Net MVC 5 application to Azure Web Apps. All has worked well until I added Application Insights yesterday. Since then, each attempt to publish my site results in a parse error. I've reviewed the application logs and telemetry but cannot discern how things have gone awry. Are there specific changes that need to be made to global.asax in order for Application Insights to place well?
Update:
I found that the web project properties Assembly Name had been accidentally modified (rookie move). I have changed it, cleaned, rebuilt, published all to no avail. Output of parse error is:
Parser Error Message: The type 'MobileFirst452.MvcApplication' is ambiguous:
it could come from assembly 'D:\home\site\wwwroot\bin\licationSeri.DLL' or
from assembly 'D:\home\site\wwwroot\bin\MobileFirst452.DLL'. Please specify
the assembly explicitly in the type name.
I deleted contents from bin folder. The contents of global.asax are as follows:
<%# Application Codebehind="Global.asax.cs"
Inherits="MobileFirst452.MvcApplication" Language="C#" %>
After posting the above update, I reviewed the files deployed to Azure. I deleted the DLL that was causing the error and can now finish testing the site. Word to the wise: check project properties prior to publishing just in case something was accidentally over-typed.
In the past, I've had no problems uploading my web site to my hosting provider but now I'm using .Net 4.5 with Nuget packages and I'm getting errors. Oh and now it's a web Application.
When I look at my file structure, I have 'MySite' as the parent folder, then under that I have the 'Packages' folder (which I assume is where the Nuget files I downloaded are installed). At the same level as the Packages folder, I have another 'MySite' folder which I uploaded to the server via FTP.
Now I'm thinking that the server would need the Packages folder but I don't know where to put it. I also thought about using the Publish feature in VS 2013 but need a .publishsettings file from my hosting provider which I do not have.
Surely there is a way to just transfer the files via FTP?
At the moment I'm getting the following error:
Parser Error Message: Could not load type 'MySite.Global'.
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="MySite.Global" Language="C#" %>
I cannot see any problem with my Global.asax.cs file at all.
please try this:
Could not load type 'XXX.Global'
"Could not load type [Namespace].Global" causing me grief
I guess the problem is because some dll is missing or your pool of IIS is not configured corretly.
Based on error I think .net version is not property set in application pool.
I have a production system and test system, both running IIS. IN the production system, everything runs fine. In the test system, I have a directed copy of the folder the site code is contained in which is set up as a virtual directory. The App_Code folder is in the root and contains all the .cs files. When running the same site in test, I get a
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 'SPTasks.master'.
Source Error:
Line 1: <%# Master Language="C#" inherits="SPTasks.master"%>
Line 2: <html>
Line 3: <head runat="server">
Source File: /SPTasks/master.master Line: 1
Any idea why this would be coming in test and not in production? Is the code not compiling for some reason?
Thanks!
Some of the comments have asked about MVC, but this looks like a WebForms application - correct me if I'm wrong? In the past I've seen this error if the application has not yet been compiled. You mention that you're copying files across one at a time. Have you actually compiled the application? If there's no dll in the bin folder containing the compiled code for your SPTasks.master.cs class, you'll get this error. As you're not using VS to compile your application, you'll need to use csc directly from the command line as per this MSDN article.
If you have a dll in there, it might be worth looking inside with a decompiler (either Reflector or Jetbrains DotPeek, which is free) to verify that the SPTasks.master.cs class is there.
Another thing to check is that the application pool that the site is running under is configured as .Net Framework Version 2.0 and not 4.0
Your IIS website is probably misconfigured. An IIS "virtual directory" is not the same thing as an application scope.
In IIS Manager, right-click the root of your application and choose "Convert to Application".
I have a Visual Studio 2010 project with a Master Page that works fine.
~/Site.Master
In the same project is a Folder with another directory structure that needs to use another Master Page.
/xr
Within this folder, I have included the Master Page for those files.
/xr/XR.Master
My Default.aspx file attempts to access this Master Page using the following include:
<%# Page Title="XR Project" Language="C#" MasterPageFile="~/xr/XR.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test1.Default" %>
Debugging on my machine in localhost works fine, but whenever I deploy it and try to navigate to the Default page in the xr folder, I get
Parser Error Message: The file '/xr/xr/XR.Master' does not exist.
However, the Source Error returns Line 1 as I have shown above.
Here is what I tried:
I moved the XR.Master page into the root folder and changed all of the files in the xr folder to reference the XR Master Page using the following include:
I debugged and tested the code on my machine using localhost, and it worked fine.
I pushed it out to the remote website and got the new error:
Parser Error Message: The file '/xr/~/XR.Master' does not exist.
What am I doing wrong?
EDIT: I do not like posting a link to the page, but I will for a short time until this is resolved:
Projects
From there, you will see everything works well enough except for the link to XR1200.
Here's the best advice I can give ya without knowing too much about your project structure.
I'm hoping you are using VS2010 so that things will look the same for you as on my machine.
One easy way to get the path of your master page all figured out is to add a test web page from masterfile, the path will be preset for you and you can use that in your existing pages.
Here is my blogs project structure.
Right click the folder where you want to add the test page and click add new file.
Add a new web form using Master Page. This is just for testing.
Now locate your Masterpage and select it.
From here just find your newly added content page in your solution structure and check the code files for the path to your masterpage.
Once you've verified that your path is correct, if it still bombs once you publish it then you've got either an issue where not all of your projects are building properly, or you're files aren't being uploaded properly and that is going to end up being something that you may just have to find on your own. I still suggest blowing away anything in your pub folder on your server and trying a clean publish.
Hope this helps!
my guess is that the iis setup is different on the different machines. typically, you see something like this when you have one machine set up with the site itself as a website and another machine set up with the site itself as an application within a website (like the Default Website). it looks like you have addressed this possibility by using the ~ in the path, but perhaps the iis on which you are deploying does not have the site directory itself set up as either a website or an application, but is merely a subdirectory of a site. in that case, the ~ would refer to the website directory (perhaps named xr?) and the site is in a subdirectory of that named xr. if this is the case, the solution is probably to set up iis such that you have the application directory configured as an application on the server to which you are deploying.