I'm developing asp.net application that uses a 3rd party API, and one of the API use a config file (dll.config).
I access the function in the API using class (.cs) file. When I try to run it, it throws a file not exception and the API won't start.
I tried to run exact same code in the WPF approach, the code works fine.
After review and searching, I tried to use configuration manager yet it does not solve my problem.
Here I attach what I've tried.
public void config3()
{
string path = "E:\\LiveStreaming\\testLiveStreaming\\testLiveStreaming\\bin\\Bosch.Dcn.Ecpc.Client.Logic.dll.config";
System.Diagnostics.Debug.WriteLine("path " + path);
try
{
RemotingConfiguration.Configure(path, false);
}
catch (Exception et)
{
System.Diagnostics.Debug.WriteLine("error conf " + et.Message);
}
}
The thrown error from debug console.
DebugCategory Information: 3 : An error occurred in DCN-SW API
initializing the server link: .Config file
'Bosch.Dcn.Ecpc.Client.Logic.dll.config' cannot be read successfully
due to exception 'System.IO.FileNotFoundException: The system cannot
find the file specified. (Exception from HRESULT: 0x80070002) at
System.BaseConfigHandler.RunParser(String fileName) at
System.ConfigTreeParser.Parse(String fileName, String configPath,
Boolean skipSecurityStuff) at
System.Runtime.Remoting.Activation.RemotingXmlConfigFileParser.ParseConfigFile(String
filename) at
System.Runtime.Remoting.RemotingConfigHandler.LoadConfigurationFromXmlFile(String
filename)'. DebugCategory Information: 4 : Availability state of the
DCN-SW API changed from b to a.
here is my web.config file
<configuration>
<configSections>
<sectionGroup name="applicationSettings">
<section name="Bosch.Dcn.Ecpc.Client.Logic.dll" type="Bosch.Dcn.Ecpc.Client.Logic,Bosch.Dcn.Ecpc.Client.Logic, Version=4.43.4.0, Culture=neutral, PublicKeyToken=99e028c462dbcff9" allowLocation="true" allowDefinition="Everywhere"/>
</sectionGroup>
</configSections>
<applicationSettings >
<Bosch.Dcn.Ecpc.Client.Logic.dll>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="0" username="">
<clientProviders>
<formatter ref="binary"/>
</clientProviders>
<serverProviders>
<formatter ref="binary" typeFilterLevel="Full"/>
</serverProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
</Bosch.Dcn.Ecpc.Client.Logic.dll>
</applicationSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer></configuration>
Related
In my config section I have the following:
<configuration>
<configSections>
<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
<section name="NFeColumns" type="System.Configuration.DictionarySectionHandler" />
<section name="CTeColumns" type="System.Configuration.DictionarySectionHandler" />
</configSections>
<appSettings>
<add key="csv.separator" value=";" />
<add key="infNFe.columns" value="NFeColumns"/>
<add key="infCte.columns" value="CTeColumns"/>
<add key="infNFe.filename" value=".\Extracted\NFeCollection.csv"/>
<add key="infCte.filename" value=".\Extracted\CTeCollection.csv"/>
</appSettings>
<NFeColumns>
<add key="infNFe.Id" value="Id" />
<add key="ide.cUF" value="cUF" />
<add key="dest.CNPJ" value="CNPJ" />
<add key="dest.xNome" value="xNome" />
<add key="det.nItem" value="nItem" />
<add key="prod.cProd" value="cProd" />
<add key="prod.xProd" value="xProd" />
<add key="IPI.cEnq" value="cEnq" />
</NFeColumns>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
I want to catch the values from and put in a IDictionary in the same order as the configuration file. I`m doing this:
string columnsSectionName = ConfigurationManager.AppSettings[colFileName + ".columns"];
IDictionary columns = (IDictionary)ConfigurationManager.GetSection(columnsSectionName);
However, Im geting the <NFeColumns> in a totally different order, and I cant figure out why. Can you please help me?
ConfigurationManager.GetSection returns an instance of HashTable. Items in a hash table won't be stored in the order they are inserted. You will have to manually order them.
I am trying to implement SQL Azure Transient Fault Configuration in my ASP.NET application. I am trying to following: http://msdn.microsoft.com/en-us/library/hh680899(v=pandp.50).aspx
Though I didn't find the block on how can I configure this in config file. I am getting The type RetryManager does not have an accessible constructor. error in my code. I read in some forum that I should configure it using config file, but how is my question. Thanks.
EDIT: I am using Enterprise Lib 5.0
Here's a sample configuration:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="RetryPolicyConfiguration" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.Configuration.RetryPolicyConfigurationSettings, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<section name="typeRegistrationProvidersConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.TypeRegistrationProvidersConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<RetryPolicyConfiguration defaultRetryStrategy="Incremental Retry Strategy" defaultSqlConnectionRetryStrategy="Backoff Retry Strategy" defaultSqlCommandRetryStrategy="Incremental Retry Strategy" defaultAzureStorageRetryStrategy="Incremental Retry Strategy" defaultAzureServiceBusRetryStrategy="Fixed Interval Retry Strategy">
<incremental name="Incremental Retry Strategy" retryIncrement="00:00:05" maxRetryCount="5" />
<fixedInterval name="Fixed Interval Retry Strategy" retryInterval="00:00:01" maxRetryCount="10" />
<exponentialBackoff name="Backoff Retry Strategy" minBackoff="00:00:01" maxBackoff="00:00:30" deltaBackoff="00:00:10" maxRetryCount="10" />
</RetryPolicyConfiguration>
<typeRegistrationProvidersConfiguration>
<clear />
<add name="Caching" sectionName="cachingConfiguration" />
<add name="Cryptography" sectionName="securityCryptographyConfiguration" />
<add name="Exception Handling" sectionName="exceptionHandling" />
<add name="Instrumentation" sectionName="instrumentationConfiguration" />
<add name="Logging" sectionName="loggingConfiguration" />
<add name="Policy Injection" sectionName="policyInjection" />
<add name="Security" sectionName="securityConfiguration" />
<add name="Data Access" providerType="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSyntheticConfigSettings, Microsoft.Practices.EnterpriseLibrary.Data" />
<add name="Validation" providerType="Microsoft.Practices.EnterpriseLibrary.Validation.Configuration.ValidationTypeRegistrationProvider, Microsoft.Practices.EnterpriseLibrary.Validation" />
<add sectionName="RetryPolicyConfiguration" name="RetryPolicyConfiguration" />
</typeRegistrationProvidersConfiguration>
<appSettings>
</appSettings>
</configuration>
I'm all of a sudden getting the following error with my Web.config file and I don't understand what it means:
Parser Error Message: The attribute 'connectionStringName' is missing or empty.
Line 24: <providers>
Line 25: <clear />
Line 26: <add name="SMDPortalMembershipProvider" type="SMDPortalMembershipProvider" />
Line 27: </providers>
Line 28: </membership>
Source File: c:\inetpub\wwwroot\web.config Line: 26
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.272
Here's my config file:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="UODOTNET, Version=2.2.5.7444,
Culture=neutral, PublicKeyToken=335F3FBD4BE82339"/>
<add assembly="System.Core, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="Default.aspx" timeout="2880" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<membership defaultProvider="SMDPortalMembershipProvider">
<providers>
<clear />
<add name="SMDPortalMembershipProvider" type="SMDPortalMembershipProvider" />
</providers>
</membership>
<customErrors mode="Off"/>
<sessionState cookieName="smd_portal_session" timeout="100"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
There is no error when I load the Default.aspx page, but as soon as my code calls upon the Membership class I'm getting the error.
Your membership provider's config section needs a connectionStringName attribute. Without that connectionStringName, it doesn't know what database to look for membership information in.
You need to add the name of one of your the connection strings in the connectionStrings section to the add tag on line 26.
The connectionStringName attribute is required in order for your Web.Config to be valid. You can't use the Membership class without it.
This is in IIS express.
public class FooHandler : HttpTaskAsyncHandler
{
public override async Task ProcessRequestAsync(HttpContext context)
{
var val = await new FooRequest().ProcessRequest();
context.Response.Write(val);
}
}
That s the handler and below is web.config.
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<sessionState mode="Off" />
<compilation debug="true" targetFramework="4.5" />
<machineKey compatibilityMode="Framework45" />
<httpHandlers>
<add verb="*" path="*.foo" validate="false" type="FooServer.FooHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="FooHandler" verb="*" path="*.foo" type="FooServer.FooHandler" />
</handlers>
</system.webServer>
</configuration>
I keep getting the below error. google didnt help. may be you can?
HTTP Error 404.7 - Not Found
The request filtering module is configured to deny the file extension.
Most likely causes:
Request filtering is configured for the Web server and the file extension for this request is explicitly denied.
I seem to be having a recurring problem. I get it all working and then this happens again a few days later. I havn't done anything to touch the entity framework or the database that is now failing. The instantiation of the Entity edmx is working but I get the following message when trying to execute a query to the database. The way I've solved it is by deleting the databases and clearing out the SQL MGMT Studio and adding them in again and refressing the edmx file.
I have 2 project: DataLayer where my entity framework definition exists, Business Logic and UI. I noticed there are some differences between the web.config between my DataLayer and the UI and don't know if that's a problem. The database was added to the App_Data folder in the DataLayer. The solution keeps adding a copy of the database to the AppData folder in the UI and addes a numberic extension to the filename in the Server Explorer( In the BL the filename is FCGuide.mdf, in the UI is was anmed FCGuide.mdf0 -- don't understand that).
Today I have deleted the database from the project and from the SQL SErver Management Studio and then tried adding it in again without a resolution. I have provided the web.config but not sure what else is needed to help with the troubleshooting. Thanks in advance.
WEB.CONFIG file from the UI:
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>
<system.webServer>
<handlers>
<remove name="ChartImageHandler" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST"
path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
</system.webServer>
<system.web>
<authorization>
<allow roles="ADMIN" />
<allow roles="MEMBER" />
<allow roles="GUEST" />
<allow roles="RESTAURANT" />
<allow users="admin" />
<allow roles="MEMBER" />
<allow roles="GUEST" />
<allow roles="GUEST" />
<allow roles="ADMIN" />
<allow users="admin" />
</authorization>
<roleManager enabled="true" />
<authentication mode="Forms" />
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false" />
</httpHandlers>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting"
assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</controls>
</pages>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="FCGuideEntities" connectionString="metadata=res://*/FCGuide.csdl|res://*/FCGuide.ssdl|res://*/FCGuide.msl;provider=System.Data.SqlClient;provider connection string="data source=.;attachdbfilename=|DataDirectory|\FCGuide.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
Web Config file from the DataLayer:
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
</system.web>
<connectionStrings>
<add name="FCGuideEntities" connectionString="metadata=res://*/FCGuide.csdl|res://*/FCGuide.ssdl|res://*/FCGuide.msl;provider=System.Data.SqlClient;provider connection string="data source=.;attachdbfilename=|DataDirectory|\FCGuide.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
"The underlying provider failed on Open": this means the connection string didn't work to allow ADO.NET to open the database.
So the provider connection string:
data source=.;attachdbfilename=|DataDirectory|\FCGuide.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework
needs some work. If you create a test page that uses SQL Connection on that string can you open and perform a simple query?
(Ie. strip things down to as few moving parts as possible).