I'm creating a multi-lingual web site using ASP.NET 2.0. So far no login required. Everything has been working fine while developing and test via VS 2005 on Windows XP Pro. But whn I compile and publish the site the Win 2003 Server throws the 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: BC30554: 'ProfileCommon' is ambiguous.
Source Error:
Line 54: End Sub
Line 55:
Line 56: Protected ReadOnly Property Profile() As ProfileCommon
Line 57: Get
Line 58: Return CType(Me.Context.Profile,ProfileCommon)
Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9f6a360\6a92c38a\App_Web_default.aspx.cdcab7d2.tal-5bet.0.vb
Line: 56
Try using a fully qualified namespace where you reference a ProfileCommom type. The compiler is finding more than one ProfileCommon type and that is the reason for the error.
Protected ReadOnly Property Profile() As
MyCompany.MyProject.MyClasses.ProfileCommon
Thanks for your reply. Regarding your first post, it makes perfect sense to me but the problem is that I have not referenced ProfileCommon from anywhere in my project. As I'm aware, this is an auto-generated class so I guess somewhere, somehow this class
is being created twice?
I'm a newbie and not that familiar with compiling in release mode. I've been precompiling the entire site using aspnet_complier, is this the same as compiling in release mode, if not how can I perform this?
I'm still having problems with this. I've examined the master page and default.aspx.cs files, removed some code and performed some tests and I still get the same error. I'm fairly sure that the problem does not arise from these two files. Could it be:
1) the web.config file configuration, do I need to add anything specific;
2) IIS 6.0, configuration and/or
3) SQL Server 2005?
Is it possible to override the ProfileCommon class or at least force the application to use a specific ProfileCommon class (i.e by adding adding the namespace?)
When you include a profile tag in your web.config, as you have, ASP.NET automatically creates new class of type ProfileCommon. It needs to do this to create properties (like you see in your error message) for each profile property that you have added in your
web.config (you have added two of them).
What you might want to try is to indicate in the web.config exactly which object you want the profile to inherit from. This is just an idea - sort of just thinking out loud - maybe it will generate more ideas from someone else.
Try changing the profile element in you web.config to this, so that you can disambiguate the class ProfileCommon:
Thanks again James for your assistance. I've cracked it though. Unfortunately the error messages I was receiving weren't providing enough clues (for me) to find the root of the problem easily enough but fortunately the solution was very simple to implement
once I had an idea of the problem.
I started a new project and pieced it together bit by bit using the files from my previous project (the one giving the errors) just until I started to receive my first error, which was...
"Failed to generate a user instance of SQL Server due to failure in retrieving the user's local
application data path. Please make sure the user has a local user profile on the computer. The
connection will be closed."
This occured when my localisation code was added (as expected)
I googled this error and found out the problem relates to the SQL Express instance that was being automatically generated, as well as the local user name on the server.
Then I read a post at
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=125227&SiteID=1 by a member that cracked it on the head for me. I didn't follow his instructions completely since my set up was different than his but I used the suggested aspnet_regsql utility to register
my existing sql server 2005 db to be used by the profile provider and VOILA!! the errors disappeared.
Also I added to web.config file :
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="data source=xxx.xxx.xxx.xxx\sqlexpress;Initial Catalog=myDB;User ID=user;Password=pass"/>
The main thing to take away from that as as side post here as this article is fairly old. Is that there is a another version of the file that the compiler is seeing with the same name. That is why its ambigous....
Deakus
Member
82 Points
22 Posts
BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
Apr 30, 2006 12:13 PM|LINK
I'm creating a multi-lingual web site using ASP.NET 2.0. So far no login required. Everything has been working fine while developing and test via VS 2005 on Windows XP Pro. But whn I compile and publish the site the Win 2003 Server throws the 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: BC30554: 'ProfileCommon' is ambiguous.
Source Error:
Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\a9f6a360\6a92c38a\App_Web_default.aspx.cdcab7d2.tal-5bet.0.vb Line: 56
----------------------------------------------------------
The master page includes the main menu and the user options to specify the language of choice:
----------------------------------------------------------
public
partial class MasterPage : System.Web.UI.MasterPage{
protected void Page_Load(object sender, EventArgs e){
DataBind();
}
protected void imgBtnEnglish_Click(object sender, ImageClickEventArgs e){
Profile.UICulture = "en-GB";Response.Redirect(Request.CurrentExecutionFilePath + "?" + Request.QueryString);
}
protected void imgBtnFrancais_Click(object sender, ImageClickEventArgs e)
{
Profile.UICulture = "fr-FR";
Response.Redirect(Request.CurrentExecutionFilePath + "?" + Request.QueryString);
}
}
----------------------------------------------------------
the code behind files the incorporate the master page file include:
----------------------------------------------------------
protected override void InitializeCulture(){
System.Globalization.
CultureInfo ci = new System.Globalization.CultureInfo(Profile.UICulture);System.Threading.
Thread.CurrentThread.CurrentCulture = ci;System.Threading.
Thread.CurrentThread.CurrentUICulture = ci; base.InitializeCulture();}
----------------------------------------------------------
and the web.config file includes:
----------------------------------------------------------
<anonymousIdentification enabled="true" />
<profile>
<properties>
<add name="UICulture" allowAnonymous="true" defaultValue="fr-FR" />
<add name="Culture" allowAnonymous="true" defaultValue="fr-FR" />
</properties>
</profile>
----------------------------------------------------------
Please can you help to determine why I'm receiving this error once the site has been compiled an published.
Many thanks,
Deacus
James Steele
Participant
875 Points
173 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
Apr 30, 2006 01:54 PM|LINK
Try using a fully qualified namespace where you reference a ProfileCommom type. The compiler is finding more than one ProfileCommon type and that is the reason for the error.
Protected ReadOnly Property Profile() As MyCompany.MyProject.MyClasses.ProfileCommon
You get the idea. That should help.
James Steele
James Steele
Participant
875 Points
173 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
Apr 30, 2006 02:00 PM|LINK
Hi Deacus,
One more thing. Try compiling for release mode (if you did not do that already).
James Steele
Deakus
Member
82 Points
22 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
Apr 30, 2006 02:09 PM|LINK
Hi James,
Thanks for your reply. Regarding your first post, it makes perfect sense to me but the problem is that I have not referenced ProfileCommon from anywhere in my project. As I'm aware, this is an auto-generated class so I guess somewhere, somehow this class is being created twice?
I'm a newbie and not that familiar with compiling in release mode. I've been precompiling the entire site using aspnet_complier, is this the same as compiling in release mode, if not how can I perform this?
Cheers,
Deakus
Deakus
Member
82 Points
22 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
Apr 30, 2006 03:33 PM|LINK
I'm still having problems with this. I've examined the master page and default.aspx.cs files, removed some code and performed some tests and I still get the same error. I'm fairly sure that the problem does not arise from these two files. Could it be:
1) the web.config file configuration, do I need to add anything specific;
2) IIS 6.0, configuration and/or
3) SQL Server 2005?
Is it possible to override the ProfileCommon class or at least force the application to use a specific ProfileCommon class (i.e by adding adding the namespace?)
Should I add anything to the Global.asax file?
Please can you provide some hints for me.
Thanks,
Deacus
James Steele
Participant
875 Points
173 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
May 01, 2006 04:41 PM|LINK
When you include a profile tag in your web.config, as you have, ASP.NET automatically creates new class of type ProfileCommon. It needs to do this to create properties (like you see in your error message) for each profile property that you have added in your web.config (you have added two of them).
What you might want to try is to indicate in the web.config exactly which object you want the profile to inherit from. This is just an idea - sort of just thinking out loud - maybe it will generate more ideas from someone else.
Try changing the profile element in you web.config to this, so that you can disambiguate the class ProfileCommon: I'll keep thinking of other ideas.
James Steele
James Steele
Participant
875 Points
173 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
May 01, 2006 04:45 PM|LINK
Deakus
Member
82 Points
22 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
May 01, 2006 10:41 PM|LINK
Thanks again James for your assistance. I've cracked it though. Unfortunately the error messages I was receiving weren't providing enough clues (for me) to find the root of the problem easily enough but fortunately the solution was very simple to implement once I had an idea of the problem.
I started a new project and pieced it together bit by bit using the files from my previous project (the one giving the errors) just until I started to receive my first error, which was...
"Failed to generate a user instance of SQL Server due to failure in retrieving the user's local
application data path. Please make sure the user has a local user profile on the computer. The
connection will be closed."
This occured when my localisation code was added (as expected)
I googled this error and found out the problem relates to the SQL Express instance that was being automatically generated, as well as the local user name on the server.
Then I read a post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=125227&SiteID=1 by a member that cracked it on the head for me. I didn't follow his instructions completely since my set up was different than his but I used the suggested aspnet_regsql utility to register my existing sql server 2005 db to be used by the profile provider and VOILA!! the errors disappeared.
Also I added to web.config file :
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="data source=xxx.xxx.xxx.xxx\sqlexpress;Initial Catalog=myDB;User ID=user;Password=pass"/>
Deakus.
James Steele
Participant
875 Points
173 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
May 01, 2006 11:06 PM|LINK
James Steele
GE-Unit
Member
11 Points
4 Posts
Re: BC30554: 'ProfileCommon' is ambiguous - - PLEASE HELP
May 04, 2007 12:34 AM|LINK
The main thing to take away from that as as side post here as this article is fairly old. Is that there is a another version of the file that the compiler is seeing with the same name. That is why its ambigous....
ambigous