Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2011, 10:07 AM
Authorized User
 
Join Date: Jan 2011
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post
Default Error recogninzing my Model on the server

Hi,

I read the book and tried to develop a site based on my blog database. I tried to implement the Entity Model in my design, but when I upload my files to the server, I get an error saying the namespace for my Model is not found. Below is a detail of the error I am getting.

Quote:
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: CS0246: The type or namespace name 'MPBlogDBModel' could not be found (are you missing a using directive or an assembly reference?)

Source Error:



Line 5: using System.Web.UI;
Line 6: using System.Web.UI.WebControls;
Line 7: using MPBlogDBModel;
Line 8:
Line 9:


Source File: d:\hosting\8577425\html\mohamedpussah\Default.aspx .cs Line: 7
In my project, I have a database called mpblogdb and I added an entity model I named MPBlogDBModel. The model is based on the database that has only one table, The CourseTable with four columns.

Below is the code I wrote in the code behind of my page:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MPBlogDBModel;


public partial class mohamedpussah_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void submitButton_Click(object sender, EventArgs e)
    {
        mpblogdbEntities myEnt = new mpblogdbEntities();

        CourseTable myCourse = new CourseTable();

        myCourse.Title = titleTextBox.Text;
        myCourse.Body = bodyTextBox.Text;
        myCourse.Comment = commentTextBox.Text;

        myEnt.AddToCourseTables(myCourse);
        myEnt.SaveChanges();
    }
}
Can anyone tell me what am doig wrong?

Here is the connetion string I am using for the entity:

Quote:
<add name="mpblogdbEntities" connectionString="metadata=res://*/App_Code.MPBlogDBModel.csdl|res://*/App_Code.MPBlogDBModel.ssdl|res://*/App_Code.MPBlogDBModel.msl;provider=System.Data.Sq lClient;provider connection string="data source=mpblogdb.db.8577425.hostedresource.com; Initial Catalog=mpblogdb; User ID=******; Password=*******;multipleactiveresultsets=True;App =EntityFramework""providerName="System.Data.Entity Client"/>

Last edited by malie22001; December 1st, 2011 at 10:25 AM.. Reason: Left out some details...
 
Old December 1st, 2011, 10:13 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Does it work on your local machine? If so, maybe you haven't uploaded all the files to the remote server?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old December 1st, 2011, 12:24 PM
Authorized User
 
Join Date: Jan 2011
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post
Default Errors

Yes, it works fine locally. I have confirmed that I uploaded all of the files. Evey file that is visible to me in the Windows Explorer was uploaded.
 
Old December 1st, 2011, 05:48 PM
Authorized User
 
Join Date: Jan 2011
Posts: 41
Thanks: 0
Thanked 1 Time in 1 Post
Default Errors

I found the problem. It seems I had too many quotes in the connection string after the provider connection string attribute.

I replaced one of the quotes with &quote; and it works fine now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Server Error 500 - Internal server error + Plesk Panel htstom Windows Server 0 September 27th, 2011 11:15 AM
SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified soufya BOOK: Beginning ASP.NET 4 : in C# and VB 7 September 14th, 2011 08:08 AM
HTTP error 500: Internal Server Error in Load Testing sherin Visual Studio 2008 0 May 19th, 2010 09:02 AM
.NET model vs. pre .NET model. raychoudhury BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 0 January 11th, 2007 06:11 AM
server error when uploading to remote server ammweb ASP.NET 1.0 and 1.1 Basics 7 July 30th, 2006 01:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.