Michael
Not sure if this reply is too late, but I have had this issue with
deployment installers too, and have had to file a few support cases to
resolve. Unfortunately, the deployment installer misses a few vital
steps, which I have had to put into my application installer, in order
to fix the issue. Basically, you have to explicity add the provider
to the machine.config file, and register the policy with the GAC to
allow different versions of SQL Anywhere 11.
This is my code, where the GAC class is taken from
http://social.msdn.microsoft.com/For...7-a46dbf38f13d
Hope this helps!
[RunInstaller(true)]
public partial class InstallActions : Installer
{
private const string SQLANY11 = "SQLANY11";
private const string DATABASE_DESCRIPTION = ".Net Framework Data
Provider for SQL Anywhere 11";
private const string DATABASE_INVARIANT =
"iAnywhere.Data.SQLAnywhere";
private const string DATABASE_NAME = "SQL Anywhere 11 Data
Provider";
private const string DATABASE_TYPE =
"iAnywhere.Data.SQLAnywhere.SAFactory, iAnywhere.Data.SQLAnywhere,
Version=11.0.1.23522, Culture=neutral,
PublicKeyToken=f222fc4333e0d400";
private const string POLICY_RELATIVE_PATH = @"Assembly\V2\policy.
11.0.iAnywhere.Data.SQLAnywhere.dll";
protected override void OnCommitted(IDictionary savedState)
{
base.OnCommitted(savedState);
try
{
string sqlPath = SQLAnywhereDir();
AddDBProviderFactory();
GAC.Register(Path.Combine(sqlPath, POLICY_RELATIVE_PATH));
}
catch { }
}
protected override void OnBeforeRollback(IDictionary savedState)
{
base.OnBeforeRollback(savedState);
try
{
string sqlPath = SQLAnywhereDir();
RemoveDBProviderFactory();
GAC.Unregister(Path.GetFileNameWithoutExtension(Pa th.Combine(sqlPath,
POLICY_RELATIVE_PATH)));
}
catch { }
}
protected override void OnBeforeUninstall(IDictionary savedState)
{
base.OnBeforeUninstall(savedState);
try
{
string sqlPath = SQLAnywhereDir();
GAC.Unregister(Path.GetFileNameWithoutExtension(Pa th.Combine(sqlPath,
POLICY_RELATIVE_PATH)));
RemoveDBProviderFactory();
}
catch { }
}
private void AddDBProviderFactory()
{
XmlDocument MachineConfigXMLFile = new XmlDocument();
try
{
Configuration MachineConfiguration =
ConfigurationManager.OpenMachineConfiguration();
string MachineConfigurationPath =
MachineConfiguration.FilePath;
MachineConfigXMLFile.Load(MachineConfigurationPath );
XmlNodeList NodesFound = MachineConfigXMLFile.SelectNodes("/
configuration/system.data/DbProviderFactories/add[@name='" +
DATABASE_NAME + "']");
if (NodesFound.Count != 0)
{
Console.WriteLine("File " + MachineConfigurationPath + "
already has an entry for SQL Anywhere. Removing First");
RemoveDBProviderFactory();
MachineConfigXMLFile.Load(MachineConfigurationPath );
}
XmlNode DBProviderFactoriesNode =
MachineConfigXMLFile.SelectSingleNode("/configuration/system.data/
DbProviderFactories");
XmlElement NewElement =
MachineConfigXMLFile.CreateElement("add");
XmlAttribute NameAttribute =
MachineConfigXMLFile.CreateAttribute("name");
XmlAttribute InvariantAttribute =
MachineConfigXMLFile.CreateAttribute("invariant");
XmlAttribute DescriptionAttribute =
MachineConfigXMLFile.CreateAttribute("description" );
XmlAttribute TypeAttribute =
MachineConfigXMLFile.CreateAttribute("type");
NameAttribute.Value = DATABASE_NAME;
InvariantAttribute.Value = DATABASE_INVARIANT;
DescriptionAttribute.Value = DATABASE_DESCRIPTION;
TypeAttribute.Value = DATABASE_TYPE;
NewElement.Attributes.Append(NameAttribute);
NewElement.Attributes.Append(InvariantAttribute);
NewElement.Attributes.Append(DescriptionAttribute) ;
NewElement.Attributes.Append(TypeAttribute);
DBProviderFactoriesNode.AppendChild(NewElement);
MachineConfigXMLFile.Save(MachineConfigurationPath );
Console.WriteLine("File updated successfully");
}
catch (Exception ex)
{
Console.WriteLine("An exception occurred " + ex.Message);
}
finally { }
}
private void RemoveDBProviderFactory()
{
XmlDocument MachineConfigXMLFile = new XmlDocument();
try
{
Configuration MachineConfiguration =
ConfigurationManager.OpenMachineConfiguration();
string MachineConfigurationPath =
MachineConfiguration.FilePath;
MachineConfigXMLFile.Load(MachineConfigurationPath );
XmlNodeList NodesFound = MachineConfigXMLFile.SelectNodes("/
configuration/system.data/DbProviderFactories/add[@name='" +
DATABASE_NAME + "']");
if (NodesFound.Count == 0)
{
Console.WriteLine("SQL Anywhere entry not found to
remove.");
}
else
{
XmlNode DBProviderFactoriesNode =
MachineConfigXMLFile.SelectSingleNode("/configuration/system.data/
DbProviderFactories");
foreach (XmlNode node in NodesFound)
{
try
{
DBProviderFactoriesNode.RemoveChild(node);
}
catch (ArgumentException) { }
}
MachineConfigXMLFile.Save(MachineConfigurationPath );
Console.WriteLine("File updated successfully");
}
}
catch (Exception ex)
{
Console.WriteLine("An exception occurred " + ex.Message);
}
finally { }
}
private string SQLAnywhereDir()
{
string sqlPath = Environment.GetEnvironmentVariable(SQLANY11,
EnvironmentVariableTarget.Machine);
return sqlPath;
}
}
On Feb 16, 6:11*pm, "Michael E." <michael.erlin... (AT) hotmail (DOT) com> wrote:
Quote:
hello
i have trouble to install a .net-application withentity-frameworkand
the asa-11.1-client on a new pc (32bit windows-7).
i created in the anywhere-deployment-assisten a setup-file with SQL-
Anywhere (32-bit) and choose only all "Client
Client interfaces", but i alway
get the following error-message:
* * System.ArgumentException: The specified store provider cannot be
found in the configuration, or is not valid. ---
System.ArgumentException: Unable to find the requested .NetFramework
Data Provider. *It may not be installed.
* *at System.Data.Common.DbProviderFactories.GetFactory( String
providerInvariantName)
which component from ASA-11 i must install on the pc., therewith
my .net-application works fine ??
have anyone a clue for my problem?
many thanks & best regards
Michael
|