Remote Debugging Silverlight Server in IIS7 - silverlight

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

Related

Unable to setup episerver default application (failed to attach the episerver database)

I'm trying to integrate Episerver into my visual studio project. I've downloaded the Episerver CMS extension through NuGet manager and everything went well.. The issue here is that when I try to access the episerver CMS panel like this:
localhost:port/episerver/cms I get the following error
Directory lookup for the file EPiServerDB_ae17da15.mdf failed with the operating system error 5(Access is denied.).Cannot attach the file EPiServerDB_ae17da15.mdf as database 'EPiServerDB_ae17da15'.
And this is my connection string:
<connectionStrings>
<add name="EPiServerDB" connectionString="Data Source=.;AttachDbFilename=|DataDirectory|EPiServerDB_ae17da15.mdf;Initial Catalog=EPiServerDB_ae17da15;Connection Timeout=60;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
What am I doing wrong here? Can someone help me out?
Try
<connectionStrings>
<add name="EPiServerDB" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|EPiServerDB_ae17da15.mdf;" providerName="System.Data.SqlClient" />
</connectionStrings>
Using the MDF-database do require you to have SQL Server LocalDB installed, I believe it is available as an install option of Visual Studio as well.
== Edit ==
If you are missing the MDF-file simply create a new using Visual Studio, create a new item and select the SQL Server Database
As Erik mentioned you will need to have SQL Server LocalDB installed to attach the .mdf file if you go with that option. If you already have the "full" SQL-server installed you can create an empty database, add the relevant connectionString and run
Initialize-EPiDatabase
in the package manager console. Now you don't need to install LocalDB.

Cannot create a local sql server 2012

I am trying to create a database for an MVC 4 application. I used Entity Framework Code first approach. After digging into the problem I realized that it was not a connection string issue. I downloaded Sql Server Data tools and tried to create it from there but I get the same exact error which is related to Windows Authentication. I am not sure what is causing this problem, I even tried running as admin.
Any ideas??
I have tried mostly all forms of connections strings available online, the last two that I tried were
<add name="Request" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=Requests;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Requests.mdf" providerName="System.Data.SqlClient" />
<!--<add name="RequestsContext" providerName="System.Data.SqlServerCe.4.0" connectionString="Data Source=|DataDirectory|\Requests.mdf" /> -->
I am trying to create a local database, I have asked a question about entity frame work right here thinking that the problem was from there but now I know it has nothing to do with it. Here you can see all of the details about the models I created and I am trying to generate the database from.
Using Entity framework with SQL Server 2012 (local *.mdf database)
You don't have SQL Server installed on your PC. Install Express Edition and you should be fine.
EDIT: Use connection string for local server:
<add name="Request" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=Request;Integrated Security=True;" />
If its local, probably SQL Server service is not running. Start>cmd and services.msc will open services page. Right click on sql server and start

MVC4 Elmah not logging remotely

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>

using login controls with sql server (not express)

I installed Visual Studio 2008 Professional(updated with SP1), then I uninstalled SQL server 2005 Express and installed SQL Server 2005 Standard.
now I am not able to add 'SQL Server Database' to the project - it says
Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly.
Is it not compliant with SQL Server Standard version?
And Login Controls also not working-
Web Administration Tool says
Unable to connect to SQL Server database
Also tried with aspnet_regsql command-line utility.. not working..(actually I dont know what is to be done after creating SQL server database through 'aspnet_regsql command-line utility')
Please Provide a solution for my problem before somebody Closes this question or marks for deletion ;P :)
The functionality to just attach a stand-alone .mdf file as a database is indeed available in the Express editions of SQL Server only.
What you should do in any other case is create the database on the SQL Server instance, and refer to it by its database name - not it's .mdf file name.
In order to create those tables and stored procedures needed for the ASP.NET membership and role subsystem, you need to use the aspnet_regsql utility against your SQL Server instance. You said that didn't work - how does it not work?? Did you get an error ?? If so: what error??
See the MSDN docs on aspnet_regsql for details on how to use it. To create the ASP.NET membership and role subsystem, use:
aspnet_regsql -S (your server name here) -E -A mr
The -E uses integrated security (e.g. your current Windows logon) to connect to SQL Server - that user accounts needs enough permissions for these operations, of course! If you need a specific SQL Server user, there's are the two -U (username) -P (password) parameters to achieve this.
Once you have all of this, you also need to configure your ASP.NET membership and role subsystem to actually use that new database (ASPNETDB) that was created on your SQL Server. By default, they use the aspnetdb.mdf file attached to your SQL Server Express instance. Since you've changed that, you need to update your configuration! See how to do this in detail on MSDN
Step 1: add a connection string to your newly created database
In your web.config or app.config, add a valid connection string to your newly created ASP.NET membership/role database - something like:
<configuration>
<connectionStrings>
<add name="ASPNETDB_Connection"
connectionString="Server=YourServer;database=aspnetdb;Integrated Security=SSPI;" />
</connectionStrings>
Step 2: - add a valid configuration for the ASP.NET membership subsystem and reference that new connection string you've just added in Step 1; something like:
<configuration>
<system.web>
<membership defaultProvider="YourProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="YourProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="ASPNETDB_Connection"
applicationName="MyApplication"
enablePasswordRetrieval="false" enablePasswordReset="true"
requiresQuestionAndAnswer="true" requiresUniqueEmail="true"
passwordFormat="Hashed" />
</providers>
</membership>
Step 3: do the same for the role subsystem:
<configuration>
<system.web>
<roleManager defaultProvider="YourProvider" enabled="true" cacheRolesInCookie="true" >
<providers>
<clear />
<add name="YourProvider"
type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="ASPNETDB_Connection"
applicationName="MyApplication" />
</providers>
</roleManager>

Elmah not working on IIS7 server

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>

Resources