I have an ASP.NET 4.0 website hosted on GoDaddy that has a database. My site will not coming up. I think it's my database connection -
My connection string -
<connectionStrings>
<add name="Personal" connectionString=" Server=xyz.com; Database=xyzDb; User ID=xyzUser; Password=xyzPass; Trusted_Connection=false" providerName="System.Data.SqlClient" />
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString=" Server=abc.com; Database=abcDb; User ID=abcUser; Password=abcPass; Trusted_Connection=false" providerName="System.Data.SqlClient" />
</connectionStrings>
The error from my page -
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.] FonyFacts02.DataAccessLayer..ctor() +74
FonyFacts02.DataAccessLayer..cctor() +39
[TypeInitializationException: The type initializer for
'FonyFacts02.DataAccessLayer' threw an exception.]
FonyFacts02.DataAccessLayer.GetInstance() +0
FonyFacts02.FonyFacts..ctor() +34
FonyFacts02.Default.Page_Load(Object sender, EventArgs e) +99
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+2207
Can anyone tell me if it is actually my connection string or something else?
The website is located at - http://www.fonyfacts.com/
Thanks
You shouldn't override the LocalSqlServer connection string name. It's defined in the machine.config file and for some reason has a special meaning making it one of the only 2 names you can't use (LocalMySqlServer being the other, also defined in machine.config). Pick any other name for your connection string.
Also, you're missing the Data Source attribute in the connection strings but I'm sure this was from your masking step.
I think you are passing some wrong values in connection string...
Server should be like
server=xpode.db.4563273.hostedresource.com
My site is also there ... and working with same connection. Please verify your db credentials
Thanks,
Rohit
xpode.com
Related
I have created a web app using Asp.net and I have published my website on my domain(I'm using Plesk) and the website is functioning correctly. In one of my pages I execute an exe file in code behind which returns an output, which then will be printed in the page. It works correctly on local host, but on Plesk I get the error "This program is blocked by group policy". This is while I have set the CAS trust level to Full, I've enabled the "precompilie during publishing" option when I published the web app. I've erased the <system.codedom> tag in web.config, but the issue is still not fixed.
Here is the stack trace:
[Win32Exception (0x80004005): This program is blocked by group policy. For more information, contact your system administrator]
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) +1889
System.Diagnostics.Process.Start() +119
Project.StyleSheets.Result.Page_Load(Object sender, EventArgs e) in E:\Soroush\Programming\Spark\Project\Project\Result.aspx.cs:24
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
Line 24 is the line at which I start the exe file, namely I execute the following code:
Process compiler = new Process();
compiler.StartInfo.FileName = Server.MapPath("~/Program/dist/News-Fetcher/News-Fetcher.exe");
compiler.StartInfo.Arguments = string.Format("{0}", Request.QueryString["search"]);
compiler.StartInfo.UseShellExecute = false;
compiler.StartInfo.RedirectStandardOutput = true;
Line24: compiler.Start();
How can I solve his problem? Thanks!
Okay so, I have been given the responsibility to migrate a website with multiple applications to another server. That migration went well (all applications working). However, the performance of that new server was sub par (whole other story). We decided to migrate it again. This time everything is working very well-- except one application.
It worked just fine on the first and second IIS servers, but is refusing to cooperate this time around.
I've mirrored all the config settings that I could find from the working server:
windows authentication enabled: check
Impersonation disabled: check
applicationpool settings match: check
I just don't know what I'm missing; why would it work on one server, but not the other.
An operations error occurred.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: An operations error occurred.
Source Error:
Line 9: Dim myUsername As String = Right(User.Identity.Name, Len(User.Identity.Name) - InStr(User.Identity.Name, "\"))
Line 10: Dim ctx = New PrincipalContext(ContextType.Domain)
Line 11: Dim myUser = UserPrincipal.FindByIdentity(ctx, myUsername)
Line 12: hfValid.Value = "false"
Line 13: For Each gp As GroupPrincipal In myUser.GetAuthorizationGroups
Source File: D:\mghnet1\isOnCall\Default.aspx.vb Line: 11
COMException (0x80072020): An operations error occurred
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +378142
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
System.DirectoryServices.PropertyValueCollection.PopulateList() +26
System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +49
System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +150
System.DirectoryServices.AccountManagement.PrincipalContext.DoLDAPDirectoryInitNoContainer() +1114
System.DirectoryServices.AccountManagement.PrincipalContext.DoDomainInit() +37
System.DirectoryServices.AccountManagement.PrincipalContext.Initialize() +112
System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx() +31
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithTypeHelper(PrincipalContext context, Type principalType, Nullable`1 identityType, String identityValue, DateTime refDate) +14
System.DirectoryServices.AccountManagement.Principal.FindByIdentityWithType(PrincipalContext context, Type principalType, String identityValue) +73
System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(PrincipalContext context, String identityValue) +28
_Default.Page_Load(Object sender, EventArgs e) in D:\mghnet1\isOnCall\Default.aspx.vb:11
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +50
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.5466; ASP.NET Version:2.0.50727.5456
Please help, none of the other forum posts I've found have posted solutions that work for me.
I'm transferring a .NET Framework 4.0 site from 1 web host to another. The site on the existing hosting seems to be working as intended. However, after transferring the site files and database to the new hosting and then fixing the web.config connection string to point to the new db, I'm getting errors when trying to access a page that pulls from the database.
I did not write the site, but it appears to be using a code-first setup.
Server Error in '/' Application.
An item with the same key has already been added.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: An item with the same key has already been added.
Source Error:
Line 130: if ((_Jobs == null))
Line 131: {
Line 132: _Jobs = base.CreateObjectSet<Job>("Jobs");
Line 133: }
Line 134: return _Jobs;
I've tried rebuilding the edmx file from the new database server after transferring the files. I know my connection string is working because I wrote a small test that connects to the database through the same connection string and it is able to retrieve data.
The only change I've made to the code base after copying it from it's working state is to the web.config's db connection string.
The only real notable difference from the old hosting versus the new hosting is that the old hosting was using SQLEXPRESS(unknown version), whereas the new hosting is using MSSQL 2008.
Stack Trace:
[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +52
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +9378779
System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.LoadRelationshipTypes() +650
System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.LoadTypesFromAssembly() +17
System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() +25
System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.Load() +4
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData) +160
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors) +166
System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies, EdmItemCollection edmItemCollection, Action`1 logLoadMessage) +316
System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection edmItemCollection) +84
System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly) +151
System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType) +35
System.Data.Objects.ObjectContext.GetEntitySetForNameAndType(String entitySetName, Type entityCLRType, String exceptionParameterName) +33
System.Data.Objects.ObjectContext.CreateObjectSet(String entitySetName) +66
PR.PRModel.PREntities.get_Jobs() in \\n5200-2\iis7_www\p\e\personallyrecommended.com.au\www\App_Code\PRModel.Designer.cs:132
Careers.LoadJob() in \\n5200-2\iis7_www\p\e\personallyrecommended.com.au\www\Careers.aspx.cs:24
Careers.Page_Load(Object sender, EventArgs e) in \\n5200-2\iis7_www\p\e\personallyrecommended.com.au\www\Careers.aspx.cs:16
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Connection String:
<connectionStrings>
<add name="PREntities" connectionString="metadata=res://*/App_Code.PRModel.csdl|res://*/App_Code.PRModel.ssdl|res://*/App_Code.PRModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=myserver.com;Initial Catalog=mydatabase;Persist Security Info=True;User ID=username;Password=password;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="ConnectionStringDB" connectionString="Data Source=myserver.com;Initial Catalog=mydatabase;Persist Security Info=True;User ID=username;Password=password" providerName="System.Data.SqlClient" />
</connectionStrings>
Using ASP.NET as programming language on IIS Server.
the Database is access and i connect to the database using ODBC.
when i fill some form in the website and press submit i get an exception:
Server Error in '/' Application.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
and stack trace is:
site.modGlobal.ExecuteSQL(String sqlStr, OdbcConnection& dbcon) +128
site.orderprd.imgbtnNextOrder_Click(Object sender, ImageClickEventArgs e) +3951
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +86
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +115
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent (String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
this is not a website that i wrote so i cannot guess where the query was executed.
how can i get a more complete stack trace in order to pinpoint the location this command was executed ?
The stacktrace seems quite explicit:
site.modGlobal.ExecuteSQL(String sqlStr, OdbcConnection& dbcon) +128
site.orderprd.imgbtnNextOrder_Click(Object sender, ImageClickEventArgs e) +3951
Those lines should give you all the information you need.
I am running my website on IIS. The default page shows this message:
Server Error in '/Enterprise/EnterpriseASP' Application.
Unable to cast object of type
'System.Web.Security.SqlMembershipProvider'
to type
'EnterpriseASPClient.Core.EnterpriseMembershipProvider'.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.InvalidCastException: Unable to
cast object of type
'System.Web.Security.SqlMembershipProvider'
to type
'EnterpriseASPClient.Core.EnterpriseMembershipProvider'.
Source Error:
Line 78: Line 79: Protected
Overrides Sub OnLoad(ByVal e As
System.EventArgs) Line 80:
MyBase.OnLoad(e) Line 81:
Helper.WireViews(Me) Line 82:
End Sub
Source File:
C:\Enterprise\EnterpriseASPClient\Core\PageBase.vb
Line: 80
Stack Trace:
[InvalidCastException: Unable to cast
object of type
'System.Web.Security.SqlMembershipProvider'
to type
'EnterpriseASPClient.Core.EnterpriseMembershipProvider'.]
Login.Page_Load(Object sender,
EventArgs e) +607
System.Web.UI.Control.OnLoad(EventArgs
e) +99
EnterpriseASPClient.Core.PageBase.OnLoad(EventArgs
e) in
C:\Enterprise\EnterpriseASPClient\Core\PageBase.vb:80
System.Web.UI.Control.LoadRecursive()
+47 System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean
includeStagesAfterAsyncPoint) +1436
How can this problem be solved?
Looks like you're incorrectly trying to cast (either explicitly or implicitly) an object of type System.Web.Security.SqlMembershipProvider to type EnterpriseASPClient.Core.EnterpriseMembershipProvider.
Please provide a little more detail about what's actually going on in your program.
I'm guessing your overridden OnLoad() function - or actually the Helper.WireViews() method it calls - is doing something inadvisable with casting.
If you're using a custom AccountMembershipProvider, remember you need to set this in your web config:
<membership defaultProvider="AccountMembershipProvider">
<providers>
<clear/>
<add name="AccountMembershipProvider" type="Foo.Bar.AccountMembershipProvider"/>
</providers>
</membership>