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.
Related
I built a WCF component resident in IIS. I have tested it and it appears to work correctly, however I'm trying to access it via the .NET Standard Class without success.
Could someone exemplify how we are expected to set C# commands to access the WCF methods?
The Visual Studio 2017 'Add Connected Service' dialogue with C# was used in a .NET Standard 2.0 Class.
Further detail
In reference.cs file there is
public interface IAvisaWCF
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAvisaWCF/DoAccess", ReplyAction="http://tempuri.org/IAvisaWCF/DoAccessResponse")]
System.Threading.Tasks.Task DoAccessAsync(string INT_IdFisico, int INT_Id, int DI_ID, string DI_IDFisico, char Numero_Leitor, string Mobile_EMEI);
public partial class AvisaWCFClient : System.ServiceModel.ClientBase<AvisaWCFRef.IAvisaWCF>, AvisaWCFRef.IAvisaWCF
{
public System.Threading.Tasks.Task DoAccessAsync(string INT_IdFisico, int INT_Id, int DI_ID, string DI_IDFisico, char Numero_Leitor, string Mobile_EMEI)
{
return base.Channel.DoAccessAsync(INT_IdFisico, INT_Id, DI_ID, DI_IDFisico, Numero_Leitor, Mobile_EMEI);
}
In the Net Standard Class (stantiated in a Android Class) I had instantiated the component and Called de Async Method, like this;
AvisaWCFRef.AvisaWCFClient oComp = new AvisaWCFRef.AvisaWCFClient();
oComp.DoAccessAsync(Int_IdFisico, Int_Id, DI_ID, DI_IdFisico, Numero_Leitor, Mobile_EMEI);
The system then gave me the following error:
Unhandled Exception:
System.ServiceModel.FaultException`1 [[System.ServiceModel.ExceptionDetail, System.ServiceModel, Version = 2.0.5.0,
Culture = neutral, PublicKeyToken = 31bf3856ad364e35]]:
An error occurred during deserialization of the request message body for the DoAccess operation.
The OperationFormatter encountered an invalid message body.
It was hoped to find 'Element' node with name 'DoAccess' and namespace 'http://tempuri.org/'.
Found element node with name 'DoAccessAsync' and namespace 'http://tempuri.org/' occurred
Could someone exemplify how I'm supposed to set C# commands to access the WCF methods?
I am trying to convert the project from here https://github.com/attilah/AngularJSAuthentication to using the mongo driver version 2 the latest one so I can adapt to my current project.
I nearly completed of my migration but I face with a few files which I dont know how to convert , because I new comming into the web api 2 and mongodb .
The problem which I am facing problem are:
ApplicationIdentityContext.cs
ApplicationUserManager.cs
ApplicationRoleManager.cs
For example with ApplicationIdentityContext.cs I have tried as the following code, but does error appear and I get stuck on this point:
namespace AngularJSAuthentication.API
{
using Entities;
using Microsoft.AspNet.Identity.EntityFramework;
using MongoDB.Driver;
public class ApplicationIdentityContext : IdentityDbContext
{
public ApplicationIdentityContext(IMongoContext mongoContext)
: this(mongoContext.Users, mongoContext.Roles)
{
}
public ApplicationIdentityContext(IMongoCollection<User> users, IMongoCollection<Role> roles)
: base(users, roles)
{
}
}
}
and then the editor show me error when I build the program :
Severity Code Description Project File Line Suppression State
Error CS1503 Argument 1: cannot convert from 'MongoDB.Driver.IMongoCollection<AngularJSAuthentication.API.Entities.User>' to 'System.Data.Common.DbConnection' AngularJSAuthentication.API D:\Projects\AngularJSAuthentication-master\AngularJSAuthentication.API\ApplicationIdentityContext.cs 14 Active
Here is my repos: https://github.com/skanel/Angular2-WebApi2-Mongodb2-Authentication
Do you have any idea?
Looks like it is a breaking change from 1.9 to 2.+. The package
AspNet.Identity.MongoDB is not compatible with the new mongo driver version 2+.
Hence the error: 'cannot convert from 'MongoDB.Driver.IMongoCollection<AngularJSAuthentication.API.Entities.User>' to 'System.Data.Common.DbConnection'
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 { ... }
I want to Deploy my ASP.Net Web Application on another Server IIS.
I already deploy it on Server but when I run that application that gives an 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 'PhurtiCRM.AutoScript'.
Source Error:
Line 1: <%# Page Language="C#" AutoEventWireup="true" CodeBehind="AutoScript.aspx.cs" Inherits="PhurtiCRM.AutoScript" %>
Line 2:
Line 3: <!DOCTYPE html>
My C# Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AutoScript.BO;
using AutoScript.BLL;
namespace PhurtiCRM
{
public partial class AutoScript : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
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!