mod_mono question: Could not resolve the name 'ConfigurationManager' - apache

I'm running mod_mono 2.4.4 on Ubuntu and I'm finding that I've had to go through my VB files and add "imports System.Configuration" to all of them to resolve the name error. This was not necessary in mod_aspdotnet on the Windows side.
I have, however, run into one error of which I can't find the source:
System.Web.Compilation.CompilationException: VBNC30451: Could not resolve the name 'ConfigurationManager'
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath, System.CodeDom.Compiler.CompilerParameters options) [0x00000]
at System.Web.Compilation.AssemblyBuilder.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000]
at System.Web.Compilation.BuildManager.GenerateAssembly (System.Web.Compilation.AssemblyBuilder abuilder, System.Collections.Generic.List`1 buildItems, System.Web.VirtualPath virtualPath, BuildKind buildKind) [0x00000]
at System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000]
Is this the result of a missed step or incorrect configuration that I have to keep adding this import?

Somewhere, probably /etc/mono/2.0/web.config, there's a default configuration file. Verify that it contains something like this:
<pages>
<namespaces>
<add namespace="System" />
<add namespace="System.Collections" />
<add namespace="System.Collections.Specialized" />
<add namespace="System.Configuration" />
<add namespace="System.Text" />
<add namespace="System.Text.RegularExpressions" />
<add namespace="System.Web" />
<add namespace="System.Web.Caching" />
<add namespace="System.Web.SessionState" />
<add namespace="System.Web.Security" />
<add namespace="System.Web.Profile" />
<add namespace="System.Web.UI" />
<add namespace="System.Web.UI.WebControls" />
<!-- <add namespace="System.Web.UI.WebControls.WebParts" /> -->
<add namespace="System.Web.UI.HtmlControls" />
</namespaces>
</pages>
Which is the default. That should take care of adding the default imports.
Btw, mod_mono 2.4.4 is a bit old these days. Try getting newer packages.

Related

#Html exists, but ActionLink is missing

I have started using VS 2015 from a previous version.
When I loaded the project, I'm missing many helpers such as
#ViewBag
#Html.ActionLink
#Html is recognised by intellisence, but not the ActionLink
In my web.config (in the root) I have
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
Why do I have no ActionLink?
Upgrading to MVC5 resolved the issue as I was previously on MVC4

imageresizer remote reader plugin only displays the remote image if no query strings are present in URL

I'm trying to resize/crop the images stored on one of our servers and use them on another, also our server. Image resizer is running on www.aapg.org. Remote images are stored on assets.aapg.org.
Not sure why it doesn't work. I followed the process outlined in http://imageresizing.net/plugins/remotereader -- everything looks OK. I tried both a signed remote URL and human-friendly syntax, and neither worked for me.
Here are the plugins from the Web.config file I'm using:
<add name="MvcRoutingShim" />
<add name="DiskCache" />
<add name="SeamCarving" />
<add name="SimpleFilters" />
<add name="PdfRenderer" downloadNativeDependencies="true" />
<add name="DropShadow" />
<add name="WhitespaceTrimmer" />
<add name="PrettyGifs" />
<add name="AnimatedGifs" />
<add name="WebPEncoder" />
<add name="WebPDecoder" />
<add name="RemoteReader" />
<add name="CloudFront" />
And the remote reader plugin configuration ('xxxxxxxxxxxxxxxxxxxxxx' is obviously not what I'm using):
<remotereader signingKey="xxxxxxxxxxxxxxxxxxxxxx" allowAllSignedRequests="false" allowRedirects="5">
<allow domain="aapg.org" />
<allow domain="assets.aapg.org" />
</remotereader>
Can anyone tell me what I'm doing wrong? Or what I'm missing?
Thanks in advance!

ELMAH in ASP.NET MVC 4 app in subfolder

Setup:
I have an ASP.NET MVC 4 app in a subfolder of the root folder (~/tracker).
I have ELMAH installed in the MVC app using NuGet.
Dev Machine:
On my dev machine the website is at the root. ELMAH works fine.
Problem on the Server:
On the server, I can see the ELMAH page, but despite generating errors, no errors get logged. It just says: "No errors found".
It also appears without any styling.
Web.config on Server:
The Elmah relevant bits on the server web.config are:
configSections:
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
appSettings:
<appSettings>
<add key="elmah.mvc.disableHandler" value="false" />
<add key="elmah.mvc.requiresAuthentication" value="true" />
<add key="elmah.mvc.allowedRoles" value="Admin" />
<add key="elmah.mvc.route" value="tracker/elmah" />
</appSettings>
httpModules:
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
system.webServer:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
</system.webServer>
Finally:
<elmah>
<errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="~/App_Data/Elmah" />
<security allowRemoteAccess="yes" />
</elmah>
ok, solved this one:
Add write permissions to the ~/App_Data/Elmah folder.
As the meerkat said, simples.
I solved it by finding the following SO answer:
Elmah.MVC does not log errors in production environment
There is also a guide for setting permissions on the ELMAH folder, or rather, a link to a guide in the accepted answer to that question.
What I can't get to work is the styling of the ELMAH pages. Any suggestions?

Could not load type 'PayPal.Manager.SDKConfigHandler' from assembly 'PayPal_Merchant_SDK'

I am trying to integrate paypal mobile checkout into a mobile web app, developed using mvc4, for some reason, when I try to use the function SetMobileExpressCheckout(xxx), I am getting the above error.
I have added the web.config entry across from the sdk example, and have added the reference to the 2 dlls that come with the SDK, but it still crashes, the full error message is below :
{"An error occurred creating the configuration section handler for paypal: Could not load type 'PayPal.Manager.SDKConfigHandler' from assembly 'PayPal_Merchant_SDK'. (C:\Projects\Mobile Development\Print Management\Print Management\web.config line 8)"}
so looking at this, it is pointing to the entry in the web config file, which is added below, I have also created a new project with an empty site, added a page, and all the web.config entries etc, and it works fine.
Could it be something to do with mvc4 ??
I know the web.config entry is large, but I thought I would put it all in there incase it is something else in there causing the problem.
any help would be much appreciated, as I am very close to having this finished, but I just cant seem to find what the issue is here
<?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>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="paypal" type="PayPal.Manager.SDKConfigHandler, PayPal_Merchant_SDK"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=aspnet-Print Management-20130104084836;Integrated Security=SSPI"/>
</connectionStrings>
<paypal>
<settings>
<!-- The URL that the user must be redirected to in order to login and approve some payment actions-->
<add name="paypalUrl" value="https://www.sandbox.paypal.com/webscr"/>
<!-- The API endpoint -->
<add name="endpoint" value="https://api-3t.sandbox.paypal.com/2.0"/>
<!-- Connection timeout in milliseconds -->
<add name="connectionTimeout" value="360000"/>
<!-- The number of times a request must be retried if the API endpoint is unresponsive -->
<add name="requestRetries" value="3"/>
<add name="binding" value="SOAP"/>
<add name="IPAddress" value="127.0.0.1"/>
<!--
API version number. You will not normally have to change this unless you
have a specific need to work with an older version of the API
-->
<add name="APIVersion" value="96.0"/>
</settings>
<accounts>
<!--
Add API credentials - 3 token or client certificate.
You can add multiple account credentials here. The SDK will pick the first account
unless you specifically request an account in the service wrapper mehod.
-->
<account apiUsername="emailaddress" apiPassword="validpassword" apiSignature="signature" applicationId="APP-80W284485P519543T" certificateSubject="" signatureSubject=""/>
<!--
<account apiUsername="enduser_biz_api1.gmail.com" apiPassword="SACH3VA3C29DXGUG"
apiCertificate="<Absolute path to paypal_cert.p12>"
privateKeyPassword="password" applicationId="APP-80W284485P519543T"/>
-->
</accounts>
</paypal>
<!-- Configure logging using the log4net library -->
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="MerchantLog.log"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] %message%newline"/>
</layout>
</appender>
<root>
<level value="DEBUG"/>
<appender-ref ref="FileAppender"/>
</root>
</log4net>
<appSettings>
<add key="webpages:Version" value="2.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="PreserveLoginUrl" value="true"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880"/>
</authentication>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
</namespaces>
</pages>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</profile>
<membership defaultProvider="DefaultMembershipProvider">
<providers>
<add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
</providers>
</membership>
<roleManager defaultProvider="DefaultRoleProvider">
<providers>
<add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/"/>
</providers>
</roleManager>
<!--
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from "InProc" to "Custom". In addition,
change the connection string named "DefaultConnection" to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
-->
<sessionState mode="InProc" customProvider="DefaultSessionProvider">
<providers>
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"/>
</providers>
</sessionState>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<handlers>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
<remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/>
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
</entityFramework>
</configuration>
Had the same issue, and could resolve it by exchanging
PayPal_Merchant_SDK
to
PayPal_Core_SDK
in the configSections part.
The assembly name is wrong in the paypal doc and samples. The config section should reference the assembly name. So "PayPal_Core_SDK" should really be "PayPalCoreSDK"
well, after trying to get it working late into the evening yesterday, I decided to create a new mvc4 mobile web app, and only put in the paypal references etc, and low and behold, it worked, now I am not sure what is wrong with the other app, but I think it will probably be quicker to just transfer my code a cross section by section.
I just thought I would let people know, and if I get chance, I will look at the code again, as I don't like been beat :-)

Elmah logging errors in SQL server but not showing up on Elmah.axd

I have Elmah set up on a WCF application and it is logging to SQL server. Everything seems to be working as far as inserting the data into the Elmah_error table. But there are 5 errors in the table and only 2 displayed on Elmah.axd.
How can I set Elmah to show all errors that are in the table?
Extra info
Errors in database
System.Web.HttpRequestValidationException
System.Exception
System.Exception
System.ArgumentException
Errors displayed on Elmah.axd
System.Web.HttpRequestValidationException
System.Web.HttpException
Web.config settings
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
 
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
</modules>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
 
<system.webServer>
<handlers>
<add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
</system.webServer>
Elmah records an application name for each log entry in the Elmar_error table. When you browse Elmah.axd it uses a default application name to filter the log entries.
You can set the applicationName attribute on the errorLog tag in the elmah Web.config section to view the entries.
<errorLog type="Elmah.SqlErrorLog" applicationName="AppName" />