Using Image Resizer AzureReader2 with MVC website "The image cannot be displayed because it contains errors" - asp.net-mvc-4

I'm trying to use Image Resizer's AzureReader2 plugin to read images from blob storage. And it works fine when I try and retrieve the unedited image.
When I go to the following url it redirects to my local storage account where the image is stored
http://localhost:2000/azure/test/image.jpg
But when I navigate to the following I get "The image cannot be displayed because it contains errors"
http://localhost:2000/azure/test/image.jpg?width=400&height=400&mode=crop&borderWidth=10&borderColor=red
Here is what my web.config file looks like
<configuration>
<configSections>
<section name="resizer" type="ImageResizer.ResizerSection,ImageResizer" requirePermission="false" />
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</httpModules>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
...
</assemblyBinding>
</runtime>
<appSettings>
...
</appSettings>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<!-- This is for IIS7/8 Integrated mode-->
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
</system.webServer>
<resizer>
<plugins>
<add name="MvcRoutingShim" />
<add name="AzureReader2" connectionString="UseDevelopmentStorage=true" endpoint="http://127.0.0.1:10000/devstoreaccount1/" />
</plugins>
</resizer>
</configuration>
Any ideas?

It seems as if the problem was to do with my Owin pipeline. The way I had the rest of my project set up it was being routed through Owin and was never able to reach the Image Resizer. I changed the set up of my project so that it wasn't routing through Owin.

Related

appConfig Unrecognized configuration section system.webServer

Good day.
I am having trouble with setting up app.config.
The issue starts when I try to access a PayPal node from appConfig.
I ran into the following error "Unrecognized configuration section system.webServer."
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="aspNetCore"/>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
</handlers>
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
<security>
<requestFiltering>
<!-- This will handle requests up to 100MB -->
<requestLimits maxAllowedContentLength="102400" />
</requestFiltering>
</security>
</system.webServer>
<configSections>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<paypal>
<settings>
<add name="mode" value="sandbox"/>
<add name="clientId" value="xxx"/>
<add name="clientSecret" value="xxx"/>
</settings>
</paypal>
</configuration>

How to deploy an ASP NET MVC 4 Web Application using Windows Server 2008 R2 and IIS 7.5?

Firstly, I am sorry for repeat a question but its solution:
Solution
It doesn't work for me. I read the articles in this solution but I can't deploy my ASP NET MVC 4 web application. I tried this:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
...
</system.webServer>
and I tried this too:
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>
I downloaded an update:
An update is available that enables certain IIS 7.0 or IIS 7.5 handlers
to handle requests whose URLs do not end with a period
Windows Update
but When I tried to install then
I am working on:
-Windows Server 2008 R2 Service Pack 1
-Internet Information Services 7.5
-Visual Studio 2013 Update 2 (Publish using Web Deploy)
-.Net Framework 4.5
My Modules
and finally my web.config (without the module tag because I was using both of them and I got the same result)
<?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>
<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>
<httpRuntime targetFramework="4.5" />
<compilation debug="true" targetFramework="4.5" />
<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.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<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>
</configuration>
When I publish my web application this is the result:
Does anyone have an idea about What am I doing wrong?
I can't deploy my MVC Web Application using one click Publish web deploy, but I deployed my Web Application using the configuration below:
I didn't need to use this tags:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
...
</system.webServer>
or
<system.webServer>
<modules>
<remove name="UrlRoutingModule-4.0" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="" />
</modules>
</system.webServer>

Glimpse is not logging Nhibernate queries (mvc3)

I have installed glimpse in my visual studio environment.
all working fine except nhibernate...
this is how I pass the factory:
factory = configuration.BuildSessionFactory();
NHibernate.Glimpse.Plugin.RegisterSessionFactory(factory);
this is my relevant sections in the web config:
<configuration>
<configSections>
<section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
</configSections>
<appSettings>
<add key="nhibernate-logger" value="NHibernate.Glimpse.LoggerFactory, NHibernate.Glimpse" />
<add key="NHibernate.Glimpse.Loggers" value="command" />
</appSettings>
<system.web>
<!-- Glimpse: This can be commented in to add additional data to the Trace tab when using WebForms
<trace writeToDiagnosticsTrace="true" enabled="true" pageOutput="false"/> -->
<httpModules>
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" />
</httpModules>
<httpHandlers>
<add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true">
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
</modules>
<handlers>
<add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" />
</handlers>
</system.webServer>
<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
</glimpse>
</configuration>
Any idea?
Thanks
Did you install the NHibernate.Glimpse NuGet package?
The Glimpse.Ado NuGet package only adds ADO profiling when used in combination with DbProviderFactory

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 :-)

How to give endpoint address in standardendpoint element tag in wcf?

in my local machine services are running fine.but while placing published files to other system then services are not running.please tell me.my web.config file is below.please tell me where to give endpoint addresses.
<?xml version="1.0" encoding="utf-8"?>
<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>
<customErrors mode="Off" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
<connectionStrings>
<add name="TestDataEntities" connectionString="metadata=res://*/AMI.csdl|res://*/AMI.ssdl|res://*/AMI.msl;provider=System.Data.SqlClient;provider connection string="Data Source=Venkat-PC;Initial Catalog=TestData;User ID=sa;Password=p#ssw0rd;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
</configuration>
You cannot define endpoint address for standard endpoint. Standard endpoint is just a template applied on the real endpoint. The real endpoint in your case should be defined by your hosted web application (url of your application) and routes defined in your Global.asax (relative part of your url).