Zipped up my application for a university assignment and now suddenly it wont work???I Used visual studio to create a class diagram and added assosciations, could this have altered the code?
Below is the error i get when i try launch in browser..
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 'WebApplication4.MvcApplication'.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.cs" Inherits="WebApplication4.MvcApplication" Language="C#" %>
Source File: /global.asax Line: 1
i get this error when i try build my project
Error 2 The type 'WebApplication4.Models.CoreSheetsDBContext' cannot be used as type parameter 'TContext' in the generic type or method 'System.Data.Entity.Migrations.DbMigrationsConfiguration'. There is no implicit reference conversion from 'WebApplication4.Models.CoreSheetsDBContext' to 'System.Data.Entity.DbContext'. G:\Software\Projects\WebApplication4\WebApplication4\Migrations\Configuration.cs 8 27 WebApplication4
// First guess was: Try changing CodeBehind to CodeFile.
Update (question was updated)
(1) A "/" at the end of line 8 is not syntactically correct. (Does it look the same in your code? Would be fine know to the rest of the line including the closing '>',)
... sealed class Configuration : DbMigrationsConfiguration
<WebApplication4.Models.CoreSheetsDBContext/
(2) Let's assume that the ´/´ was just a typo and your code contains a ´>´ instead. DbMigrationsConfiguration has this signature:
public class DbMigrationsConfiguration<TContext>
: DbMigrationsConfiguration where TContext : System.Data.Entity.DbContext
The class CoreSheetsDBContext which you pass as a generic parameter must be a subclass of System.Data.Entity.DbContext. Check that CoreSheetsDBContext actually inherits from System.Data.Entity.DbContext. I.e. it should look like this:
using System.Data.Entity;
public class CoreSheetsDBContext : DbContext { ... }
Related
I have web service (wcf c#) that uses entity framework.
It worked perfectly, but I updated the model and now I get error:
class is an ambiguous reference between NameSpace1.Class and
NameSpace2.Class.
I work in visualStudio 2012, and it suggests to change the type to NameSpace1.Class or NameSpace2.Class (Class is my class name and NameSpace1/2 are my namespaces names)
I choose the type I want - NameSpace1.Class, but then I get error:
The type or namespace name 'NameSpace1' does not exist in the
namespace.
but I dont understand - It does exist. and vs itself suggested me to choose it.
I tried everything: rebooting vs, cleaning and rebuilding the solution, and even rebooting my computer, but nothing helped.
maybe the error is wrong?
edit
well, the error comes from this line:
public IEnumerable<MyClass> GetMyClassList()
the options are: NameSpace1.MyClass or NameSpace2.MyClass.
I Click on the first, and it changed to:
public IEnumerable<NameSpace1.MyClass> GetMyClassList()
and then get error :
The type or namespace name 'Class' does not exist in the namespace 'Bll.NameSpace1'.
I think, that maybe the error occures because I have the namespace NameSpace1 twice: one in Bll.NameSpace1 (Bll is my current project) and the second in Reference with the name NameSpace1.
This question already has answers here:
Parser Error Message: Could not create type 'xxx'
(3 answers)
Closed 8 years ago.
i am new to .net and i have to create a webservice for connecting with android.i got a simple example code and i put it in a mew webservice application and run it in debug mode.but it shows the following error in firefox.pls help to correct it.
Service1.asmx.cs
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Services;
namespace HelloAndroid
{
[WebService(Namespace = "http://sample.com/")]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string SayHello()
{
return "Hello, Android from .NET";
}
}
}
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 create type 'WebService1.Service1'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="Service1.asmx.cs" Class="WebService1.Service1" %>
Source File: /Service1.asmx Line: 1
Version Information: Microsoft .NET Framework Version:2.0.50727.6387; ASP.NET Version:2.0.50727.6387
You've probably changed the namespace from WebService1 to HelloAndroid in Service1.asmx.cs. You need to update Service1.asmx file as well.
I am running asp.net, C#4.0 application in VS2010. I get the following compilation error:
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 1: using System;
Line 2: using System.Collections.Generic;
Line 3: using System.Linq;
My page attribute is :
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs"
EnableEventValidation="false" Inherits="jsPlumb_jsPlumb_Default2" %>
my c#codebehind class:
namespace CompanyDisplay.jsPlumb.jsPlumb.jsPlumb
{
public class jsPlumb_jsPlumb_Default2 : System.Web.UI.Page
{
}
}
i want namespace to present for running some webservice applications.
Try to do this :
add batch=”false” in the compilation tag of your applications web.config file as shown below
compilation debug=”true” batch=”false”
clean solution
delete the temporary files folder in Visual Studio(the folder which it shows in the exception)
do an iisreset and the rebuild my code again
I got the ANSWER ; I should give the inherit attribute as;
inherits="CompanyDisplay.jsPlumb.jsPlumb.jsPlumb.jsPlumb_jsPlumb_Default2"
This error shows up when code-behind class name doesn't match "inherits" attribute on your aspx page. Maybe you tried to rename something?
Furthermore, I've seen this error, when you try to view a new page, but didn't compile the source, so even though your aspx exists, it can't fight the corresponding code-behind class.
Edit:
You have a completely messed up naming conventions, no surprise you're having troubles to match class names properly.
Sorry, but this is just preposterous!
inherits="CompanyDisplay.jsPlumb.jsPlumb.jsPlumb.jsPlumb_jsPlumb_Default2"
Fix your conventions and maybe you find yourself having source files like this:
CodeBehind="Default.aspx.cs" Inherits="MyNamespace.jsPlumb.Default"
Don't do it like jsPlumb.jsPlumb.jsPlumb....That's just a nightmare!
I have movied my webpage to a new webhost and now I get this exception from time to time :
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'basePage' exists in both
'c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET
Files\root\60a943dd\2f0f659a\App_Code.n45tvdm2.dll' and
'c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET
Files\root\60a943dd\2f0f659a\App_Code.4kvzrnma.dll'
Source Error:
Line 9: using System.Web.UI.HtmlControls; Line 10: Line 11: public
partial class _Default : basePage Line 12: { Line 13: protected
void Page_Load(object sender, EventArgs e)
Source File:
\webstorage\storage_content\28\106228\MySite\public_html\sites\MySite\Default.aspx.cs
Line: 11
This has worked well on the old webhost.
I have read this and this but I do not get this, why have this been working on the old webhost? Nothing have been changed in the ASP.NET solution?
Delete every thing from "c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\" location and try.
I have been trying to figure this out for a while now and even though there are plenty of Google results for the error message I receive the solution eludes me. I think that I am doing what I am supposed to be doing.
VS2010, I created a common.cs in App_Data. The content of common.cs are functions which will be used by all pages. As far as I can tell this is the proper way to share code-behind code among multiple pages.
App_Data\common.cs
namespace nprah
{
public class BasePage : System.Web.UI.Page
{
}
{
fish-creek.aspx.cs
namespace nprah
{
public partial class Fishck : BasePage
{
}
}
fish-creek.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeFile="fish-creek.aspx.cs" Inherits="nprah.BasePage" %>
If I understand the Inherits attribute correctly then it does need to contain the NameSpace.ClassName, which mine does. See: http://support.microsoft.com/kb/312311
When I run this code it results in the following output:
Compiler Error Message: ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl).
Source Error:
Line 11: {
Line 12:
Line 13: public partial class Fishck : BasePage
Line 14: {
Line 15:
Visual Studio is not showing any errors during the design. Any guidance you may be able to provide will be much appreciated. Thanks in advance.
In your ASPX it should be
Inherits="nprah.Fishck"
Inherits in your .aspx should be mapping to your code file(.cs)... and from there your codefile will inherit your basepage like you already did.
And also try to validate that : CodeFile="fish-creek.aspx.cs".
Because with the name of the file you supplied it should be : Codefile="fishck.aspx.cs".
Maybe just a typo.