XML cusomter membership provider type c# - web-config

Here is my class declaration:
public class XmlMembershipProvider : MembershipProvider
{....}
and my web.config snipit:
<membership defaultProvider="CustomXmlMembershipProvider">
<providers>
<add name ="CustomXmlMembershipProvider" type="XmlMembershipProvider" xmlFilePath="App_Data\Userstore.xml"/> .....
I am not sure what to do from this point. I have done a ton of google searching but cannot find out why I am getting the following error:
Parser Error Message: Could not load type 'XmlMembershipProvider'.

The type string should also include the assembly name that contains the XmlMembershipProvider.
<add name="..." type="XmlMembershipprovider, MyAssembly" .../>

Only adding the reference to the assembly (as below) still gave errors, although it is a step in the right direction:
<add name="..." type="XmlMembershipprovider, MyAssembly" .../>
I found that the fully qualified reference to the assembly should ALSO be added as follows:
<add name="..." type="MyAssembly.XmlMembershipprovider, MyAssembly" .../>
Now it works.

Related

CodeEffects - Existing rules error after upgrade

After upgrading codeeffects from 4.3.2.6 to 4.3.6.7 existing rules that have any coded actions or methods fail to load with the error:
"The highlighted rule elements could not be located in the current source object. Please update this rule or roll back all changes made to the source object."
Followed by the following in the rules editor
How can this be overcome?
Prior to the upgrade the rules threw no errors and acted against the data as expected.
The errors and the XML below come from the downloaded demo. After updating the demo I encountered the same issues.
The XML for the rule:
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="http://codeeffects.com/schemas/rule/41" xmlns:ui="http://codeeffects.com/schemas/ui/4">
<rule id="2eb43e80-320c-496f-bf50-7ead12bae886" webrule="4.1.6.4" utc="2014-08-05T15:29:26.3909" type="CodeEffects.Rule.Demo.Bre.Mvc.Models.Patient, CodeEffects.Rule.Demo.Bre.Mvc.2013, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true">
<name>Check Date</name>
<definition>
<condition type="equal">
<method name="IsToday" type="CodeEffects.Rule.Demo.Bre.Mvc.Services.PatientService, CodeEffects.Rule.Demo.Bre.Mvc.2013, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
<value type="System.Nullable`1[[System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]">2014-08-06T00:00:00.0000</value>
</method>
<value type="System.Boolean">true</value>
</condition>
</definition>
<format>
<lines />
</format>
</rule>
</codeeffects>
I've tried updating the webrule="4.1.6.4" value in the XML to match the new version without success.
First, please check that your project actually declares the "missing" method. Then post your rule XML here, at least its portion that uses that method if the entire rule is too large.

Installing multiple Quartz.NET services on one machine

I'm using Quartz.NET 2.2.400.0 and am experiencing problems installing multiple instances on a single machine.
I am trying to amend the name of the instance via the configuration file (Quartz.Server.exe) as follows:
<quartz >
<add key="quartz.checkConfiguration" value="false"/>
<add key="quartz.server.serviceName" value="CalSched"/>
<add key="quartz.server.serviceDisplayName" value="CalSched"/>
<add key="quartz.server.serviceDescription" value="CalSchedservice"/>
</quartz>
When running Quartz.Server.exe install without the above, everything works perfectly. When the service name is specified, the scheduler does not run.
I wondered if anybody would be able to shed any light on this?
This is an old thread. But I will put the answer here in case someone got same issue. When <quartz> tag (Quartz.Server.exe.config) is used, quartz will ignore configurations in quartz.config and therefore, this configuration line is ignored quartz.plugin.xml.fileNames = ~/quartz_jobs.xml. As a result, quartz won't read your job settings and won't run the job as expected.
So you need to move all your configuration to tag. You need to add
<quartz >
<add key="quartz.checkConfiguration" value="false"/>
<add key="quartz.server.serviceName" value="CalSched"/>
<add key="quartz.server.serviceDisplayName" value="CalSched"/>
<add key="quartz.server.serviceDescription" value="CalSchedservice"/>
<!-- MUST ADD -->
<add key="quartz.plugin.xml.type" value="Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz" />
<add key="quartz.plugin.xml.fileNames" value="~/quartz_jobs.xml" />
</quartz>
And it will work.

EF4 The provider did not return a Provider Manifest Token string

Yes, one more question about Provider manifest token. Unfortunately all previous 22 questions was not useful to solve my problem. I developing simple web application using MVC4 + Code First + Sql Express.
Here is my context descendant:
public class MCQContext : DbContext
{
public MCQContext()
: base("name=ApplicationConnection")
{
}
...............
}
And here - part of web.config related to the problem:
<configuration>
<configSections>
<section name="entityFramework"
type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission="false" />
</configSections>
<connectionStrings>
<add name="ApplicationConnection"
connectionString="Data Source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
<parameters>
<parameter value="name=ApplicationConnection" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
So, as you can see, correct connection string passed to base of context class (I got the same error if I rename connection string to "MCQContext" and do not pass anything to parent context class).
I have no idea how to fix it. This behavior reproduced if I creating absolutely empty MVC4 application, remove all packages (I prefer manually specify required assemblies and do not use NuGet) and fix references (including reference to sqlserver express).
The problem with your connection string here is:
<add name="TrempimModel"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|aspnetdb.sdf;
User Instance=true"
providerName="System.Data.SqlClient" />
You're basically defining what "server" you're connecting to - but you're not saying what database inside the file to connect to. Also - the file extension for SQL Server Express database files is .mdf (not .sdf - that's SQL Server Compact Edition) - you need to take that into account, too! (was a typo, according to comment by OP).
You need to define an extra database=.... (or Initial Catalog=.....) in your connection string:
<add name="TrempimModel"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;
database=YourDatabaseName;
AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient" />
Then it should work just fine.

Azure Diagnostics: Trace messages don't work in VS2012 default template

I'm unable to get Azure Diagnostics to spit out any of my Trace messages - even in the near-as-is VS2012 project template. Here is what I did:
In an empty VS2012, created a new Cloud project (called it "Azure.Diag")
In the wizards next step, added the default template for "WCF Service Web Role" (called it "WCFService.WebRole")
Editted Web.Config to enable Diagnostics (details below)
Editted WebRole.cs to spit a Diagnostic Trace message (details below)
Ran it locally in Azure Emulator (ServiceConfiguration.Local.cscfg: Diagnostics.ConnectionString is "UseDevelopmentStorage=true")
Look at C:\Users\<Username>\AppData\Local\dftmp\Resources\<Instance GUID>\directory\WCFService.WebRole.svclog => see nothing!
There is also nothing in the Local Storage Blog either (not surprising given the folder before move-to-blob is empty)
How can I get this working? I'm trying to avoid my own handwritten .txt logs to leverage the in built trace listener framework (and parsing tools).
WebRole.cs
using System.Diagnostics;
namespace WCFService.WebRole
{
public class WebRole : RoleEntryPoint
{
public override bool OnStart()
{
// To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
string message = "Houston, tracing is broken!";
Trace.TraceError(message);
Trace.TraceInformation(message);
Trace.TraceWarning(message);
Trace.WriteLine(message);
return base.OnStart();
}
}
}
Web.Config:
I used the standard template one but uncommented the top portion (had to merge the two system.diagnostic portions to avoid HTTP 500)
<system.diagnostics>
<sharedListeners>
<add name="AzureLocalStorage" type="WCFService.WebRole.AzureLocalStorageTraceListener, WCFService.WebRole" />
</sharedListeners>
<!--<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
</sources>-->
<trace autoflush="true">
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>

403.14 and defaultDocument

We are having a problem on our web server which is driving us mad!!
When we define defaultDocument in our web.config we always get the dreaded 403.14 Http error. The config is (inside system.webserver):
<defaultDocument enabled="true">
<files>
<clear/>
<add value="~/Forms_Mosaic/Our System.aspx"/>
</files>
</defaultDocument>
We are using IIS 7.0 and if we turn directory browsing on we can happily browse to the specified file. We have the folders that it reside in set to ANONYMOUS LOGON user credentials and can also access the page with a fully qualified url.
Can anyone suggest why we keep getting this error?
Thanks.
I came across a similar issue today and found that the tilde (~) and leading forward slash were causing the issue. For example, while the following doesn't seem to work:
<defaultDocument enabled="true">
<files>
<add value="~/test.htm" />
</files>
</defaultDocument>
specifying the file just as a plain-ole-relative URL worked fine, at least for me:
<defaultDocument enabled="true">
<files>
<add value="test.htm" />
</files>
</defaultDocument>
Note though that if your desired default document's in a subfolder relative to the application root (as seems to be the case for you) then when you browse to the subfolder you're going to get the same issue. For example, if you browse to http://example.com/Forms_Mosaic/ IIS'll be looking for a default document at http://example.com/Forms_Mosaic/Forms_Mosaic/Our%System.aspx which obviously won't exist.
Strikes me that a default.aspx in the root folder with a Server.Transfer or Response.Redirect might be a better solution in the specific case of the OP, rather than using a site-wide setting to handle what's really a folder-specific problem.
The value you specified is not a valid URL. Try:
<defaultDocument enabled="true">
<files>
<clear/>
<add value="~/Forms_Mosaic/Our%20System.aspx"/>
</files>
</defaultDocument>
You may also get this error if you are using urlMappings. In this case, the value will have to be the non-mapped value. So for the following situation, you will see the error if the value is page-b.aspx but not if it is page-a.aspx.
<urlMappings>
<add mappedURL="~/page-a.aspx" url="~/page-b.aspx" />
</urlMappings>