I have Elmah running on my MVC 3 site, and have everything working on my local development machine.
However, now that I've moved my site to my production server, Elmah is not working. I am using the same SQL account (and connection string) on my live server as I'm using on my local machine. The EF4 connection (same as Elmah) works just fine.
I don't see anything in the Even Logs or in SQL Profiler. I don't see any errors in the SQL logs either.
Any ideas on what could be happening, or how I could troubleshoot this?
Thanks in advance.
ELMAH is using a HttpModule to log errors. For IIS6, HttpModules are registered under System.Web in the web.config file. However, for IIS7+, HttpModules should be registered under the system.webserver namespace. The embedded development web server will use the IIS6 config.
IIS6:
<system.web>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
</httpModules>
</system.web>
IIS7:
<system.webServer>
<modules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
</modules>
</system.webServer>
Related
So we have developed an MVC application with EF database first and are trying to deploy the solution to Production environment. however the database server is on a different server and hence we would have to provide a conenction string pointing to the DB server. We tried couple of methods but weren't successful.
Whats the approach for deployments for EF DB first?
Have you tried this code?
Configuration connectionConfiguration = WebConfigurationManager.OpenWebConfiguration("~");
connectionConfiguration.ConnectionStrings.ConnectionStrings["test"].ConnectionString = txtConnectionString.Text;
connectionConfiguration.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("connectionStrings");
It will rewrite your web.config with new values
When deploying to a production environment, an application is typically compiled in Release mode. In this mode you can use Web.Release.config to specify the variables that should be different in production.
Say your connection string in Web.config is
<add name="MyContext"
connectionString="DevConnectionString"
providerName="System.Data.SqlClient" />
You can add this in Web.Release.config:
<add name="MyContext"
connectionString="ProdConnectionString"
providerName="System.Data.SqlClient"
xdt:Transform="SetAttributes"
xdt:Locator="Match(name)" />
When deploying to production the connection string will automatically change to "ProdConnectionString".
For more information on Web.config transforms see How to: Transform Web.config When Deploying a Web Application Project
I recently upgraded my PC from Windows 7 to Windows 8.1 and am now having problems resetting up my local DNN5 environment.
I pulled my DNN5 instance down from a remote git repo, and just finished importing all of the tables/data/stored procedures from the production DB to a local instance.
I have updated the connection strings in the web.config to reflect my new database, but still, no matter what I do, I am getting redirected to http://localhost/DNN5/Install/UnderConstruction.htm.
What am I missing?
for completeness, here are my connection strings and a screencap of my db:
<connectionStrings>
<add name="SiteSqlServer" connectionString="Data Source=KMCNUTT-7\DWYATTMSSQL;Initial Catalog=DNN5;User ID=sa;Password=******"
providerName="System.Data.SqlClient" />
<add name="DNN5ConnectionString" connectionString="Data Source=KMCNUTT-7\DWYATTMSSQL;Initial Catalog=DNN5;User ID=sa;Password=******"
providerName="System.Data.SqlClient" />
</connectionStrings>
This almost always happens when you are unable to connect to the database from DNN.
Navigate to
http://localhost/DNN5/Install/install.aspx
and see if it throws a connection error just to be sure.
Is this a local database? If so try using (local)\InstanceName (I assume your instance name is DWYATTMSSQL) so (local)\DWYATTMSSQL
Also make sure that you have SQL authentication enabled in SQL server, instead of Windows Authentication only, which is the default for SQL installations.
I have setup a local installation of DNN7 using a database residing in another machine (sqlserver 2008).
I've tried to copy all the filesystem to a production server but keep the connection string the same, so use the exact same database.
I get the message
"The connection name 'LocalSqlServer' was not found in the applications configuration or the connection string is empty."
<roleManager>
<providers>
<add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
The application pool and IIS settings are the same in both machines. Any ideas of what am I missing?
You are missing following section in web.config
<connectionStrings>
<!-- Connection String for SQL Server 2005/2008 Express -->
<!-- Connection String for SQL Server 2005/2008
<add name="SiteSqlServer" connectionString="Server=(local);Database=DotNetNuke;uid=;pwd=;" providerName="System.Data.SqlClient" />
-->
</connectionStrings>
The problem had to do with the role membership provider.
For some reason the AspNetSqlMembershipProvider provider falls back at the default one which is in the machine.config (insided the .NET folder).
In dev environments with an SQLEXpress instance running, the machine.config has a connection string named 'LocalSqlServer' which points to the SQLExpress. That's why it worked in my dev environment.
The server on the other hand, doesn't have SQLExpress, so no LocalSqlServer connectionstring exists in the machine.config and therefore the error pops up.
The workaround I found in DNN forums is to add these lines inside the section of the web.config
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="Data Source=dbserver;Integrated Security=false;Initial Catalog=dbName;User ID=dbUser;Password=dbPass" providerName="System.Data.SqlClient" />
I have a website which is working fine locally but not on remote server. Its a MVC4 and Elmah is configured for SQL Server.
I can throw a simple error and see it on elmah locally in my iis (same code).
Config are exactly same, SQL Server ... everything.
On remote server when I test the elmah with http://example.com/elmah.axd/test
it logs the error correctly.
Any other error in code is not showing up on elmah.
I checked the Application Pool and its integrated.
I appreciate any help or idea.
You need to enable Elmah for remote access by adding the following configuration setting to the section in your web.config file. The default setting for this value is false, which only allows localhost, hence why it is working on your local machine from within Visual Studio.
<elmah>
<security allowRemoteAccess="true"/>
</elmah>
Make sure you HttpHandler is defined in the webServer section in your web.config file.
<system.webServer>
<httpHandlers>
<add name="elmah" verb="GET" path="elmah.axd" type=type="Elmah.ErrorLogPageFactory, Elmah"/>
</httpHandlers>
</system.webServer>
I have a problem on the server side of my Silverlight application. It's in one of my WCF Services. The app works fine on my dev machine, but is failing on the test server. I'd like to find a way to remote debug my service from my dev machine. Is this possible using Visual Studio 2010?
Since the WCF Service and Server side application is hosted within IIS7, I don't know how to attach to get it started.
Any help is greatly appriciated,
-Scott
In Visual Studio 2010:
Install the Microsoft Visual Studio Remote Debugging Monitor on the server (MSVSMON.exe)
Debug Menu...Attach to process -
select the Transport to Remote or Default
Select the Qualifier to the server name
Select the process to attach to in the Available Processes list and press Attach
Put this in your web.config file:
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\temp\WEBTraces.log" />
</listeners>
</source>
</sources>
</system.diagnostics>
Read more of this here: http://msdn.microsoft.com/en-us/library/ms733025.aspx