I am getting bad request from ASP.Net website on submitting the large file 2GB using AJAX.
My HTTP runtime setting
<httpRuntime maxRequestLength="2147483647" executionTimeout="3600"/>
Please help.
Web.Config
`
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="microsoft.web.services3" type="Microsoft.Web.Services3.Configuration.WebServicesConfiguration, Microsoft.Web.Services3, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="" providerName="System.Data.SqlClient"/>
<add name="psDevDataConnectionString1" connectionString="" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="50000000" />
</webServices>
</scripting>
</system.web.extensions>
<system.web>
<authentication mode="Forms"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime maxRequestLength="2147483647" executionTimeout="3600"/>
<membership defaultProvider="xplProvider">
<providers>
<add name="xplProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="10" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
</providers>
</membership>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<customErrors mode="RemoteOnly" defaultRedirect="~/sysError.aspx">
<error statusCode="404" redirect="~/infoCollector.aspx"/>
</customErrors>
<pages controlRenderingCompatibilityVersion="4.0" clientIDMode="Static"/>
</system.web>
<system.webServer>
<handlers>
<add name="DocImage" verb="GET,POST" path="DocImage.axd" type="DotnetDaddy.DocumentViewer.DocImageHandler, DocumentViewer"/>
<add name="pngs" verb="*" path="ClientPortals/images/*" type="Project.UserInterface.ClientPortals.image" preCondition="managedHandler"/>
</handlers>
<modules>
<add name="UploadModule" type="RTE.UploadModule,RichTextEditor"/>
<add name="CuteEditor.UploadModule" type="CuteEditor.UploadModule,CuteEditor"/>
</modules>
<httpErrors errorMode="Custom" defaultResponseMode="ExecuteURL">
<remove statusCode="404"/>
<error statusCode="404" path="/scenter.aspx" responseMode="ExecuteURL"/>
</httpErrors>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="4294967296"/>
</requestFiltering>
</security>
</system.webServer>
<appSettings>
<add key="PageInspector:ServerCodeMappingSupport" value="Disabled"/>
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ServiceSoap">
<security mode="Transport"/>
</binding>
<binding name="ServiceSoap1"/>
<binding name="sms2SOAPbasicHttpBinding"/>
<binding name="sms2SOAPbasicHttpsBinding">
<security mode="Transport"/>
</binding>
</basicHttpBinding>
<wsHttpBinding>
<binding name="sms2wsHttpBinding">
<security mode="None"/>
</binding>
<binding name="sms2wsHttpBindingSecure">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://api.authorize.net/soap/v1/Service.asmx" binding="basicHttpBinding" bindingConfiguration="ServiceSoap" contract="ArbApiSoap.ServiceSoap" name="ServiceSoap"/>
<endpoint address="http://sms2.cdyne.com/sms.svc/Soap" binding="basicHttpBinding" bindingConfiguration="sms2SOAPbasicHttpBinding" contract="cdyneSMS.Isms" name="sms2SOAPbasicHttpBinding"/>
<endpoint address="https://sms2.cdyne.com/sms.svc/SecureSoap" binding="basicHttpBinding" bindingConfiguration="sms2SOAPbasicHttpsBinding" contract="cdyneSMS.Isms" name="sms2SOAPbasicHttpsBinding"/>
<endpoint address="http://sms2.cdyne.com/sms.svc/WS" binding="wsHttpBinding" bindingConfiguration="sms2wsHttpBinding" contract="cdyneSMS.Isms" name="sms2wsHttpBinding"/>
<endpoint address="https://sms2.cdyne.com/sms.svc/WS" binding="wsHttpBinding" bindingConfiguration="sms2wsHttpBindingSecure" contract="cdyneSMS.Isms" name="sms2wsHttpBindingSecure"/>
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="AWSSDK" publicKeyToken="9f476d3089b52be3" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-2.3.55.0" newVersion="2.3.55.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<microsoft.web.services3>
<messaging>
<executionTimeoutInSeconds value="300" />
<maxMessageLength value="524288000" />
</messaging>
</microsoft.web.services3>
</configuration>
`
maxRequestLength is in Kilobyte not byte so 2147483647 Kilobytes is about 2000 GB that's a lot. 2GB = 2097152 KB. Try to change it to 2097152
On the other hand, maxAllowedContentLength is in bytes.
It is recommended to place both those values in web.config.
The maxRequestLength indicates the maximum file upload size supported by ASP.NET, the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS. Hence, we need to set both maxRequestLength and maxAllowedContentLength values to upload large files.
<system.web>
<httpRuntime maxRequestLength="2097152" executionTimeout="3600"/>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
</system.webServer>
Related
I am trying to connect to a WCF service over https and i get the following error
An error occurred while making the HTTP request to https://mysite/App/Service/MyService.svc.
This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.
Please help me out of this issue. We need to move to prod by weekend.
WCF web.config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<configSections><sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="rptBuildProvider" type="CrystalDecisions.Shared.RptBuildProviderHandler, CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304, Custom=null" />
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings>
<add key="MyEnv" value="Server01" />
</appSettings>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="Oracle.DataAccess, Version=2.112.1.0, Culture=neutral, PublicKeyToken=89B483F429C47342" />
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304" />
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
</assemblies>
<buildProviders><add extension=".rpt" type="CrystalDecisions.Web.Compilation.RptBuildProvider, CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" /></buildProviders>
</compilation>
<customErrors mode="Off" />
<pages>
<namespaces>
<add namespace="System.Runtime.Serialization" />
<add namespace="System.ServiceModel" />
<add namespace="System.ServiceModel.Web" />
</namespaces>
</pages>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<add value="MyService.svc" />
</files>
</defaultDocument>
</system.webServer>
<businessObjects><crystalReports><rptBuildProvider><add embedRptInResource="true" /></rptBuildProvider></crystalReports></businessObjects></configuration>
Web Application web.config file:
<configuration>
<appSettings>
<add key="HelpLoadMode" value="All" />
</appSettings>
<system.web>
<sessionState mode="InProc" timeout="35"></sessionState>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
<assemblies>
<add assembly="System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
<customErrors mode="Off"></customErrors>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"></serviceHostingEnvironment>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IReportService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="4194304" maxBufferPoolSize="10485760" maxReceivedMessageSize="4194304"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="6400" maxStringContentLength="4194304" maxArrayLength="131072"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IMyService1" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://mysite/App/Service/MyService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
contract="MyService.IMyService" name="BasicHttpBinding_IMyService" />
</client>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
<system.webServer>
<caching>
<profiles>
<add extension=".png" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
<add extension=".gif" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
<add extension=".css" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
<add extension=".js" policy="CacheUntilChange" kernelCachePolicy="CacheUntilChange" />
</profiles>
</caching>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
By default, WCF configuration only supports HTTP protocol to expose the service, we need to set up the additional service endpoint in the System.ServiceModel section.
Please consider the below configuration.
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
</system.serviceModel>
Then we specify an https binding in IIS.
After publishing the service in IIS, we add the service reference on the client to generate the client proxy. It would auto-generate the https endpoint.
One thing must be noted is that we should trust the server certificate when calling the service with the HTTPS endpoint on the server-side.
There are two ways to accomplished this.
Use the below code segments before instantiating the client proxy
class.
ServicePointManager.ServerCertificateValidationCallback += delegate
{
return true;
};
Install the server certificate on the client-side Trusted Root
Certification Authorities(certificate store).
Feel free to let me know if the problem still exists.
I am getting deep trouble for by just changing web.config content. After so many traces, I have found that it causes because I have changed web.config.
When I change my web.config file, UseSSL parameter get "False". This cause so many issues like Payment Gateway.
Can anybody suggest me which thing make it false?
Following are new element that is not there in old web.config.
<configuration>
<system.web>
<compilation debug="false" strict="true" explicit="true" targetFramework="4.6.2" optimizeCompilations="true" enablePrefetchOptimization="true">
<assemblies>
</assemblies>
</compilation>
<trace enabled="false" localOnly="true"/>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" pageParserFilterType="BVSoftware.Bvc5.Core.Utilities.BVPageParserFilter">
<authentication mode="None"/>
<httpCookies httpOnlyCookies="true" requireSSL="false" />
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<httpErrors errorMode="Custom">
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="/Error.aspx" responseMode="ExecuteURL" />
<error statusCode="403" subStatusCode="14" path="/Error.aspx" responseMode="ExecuteURL" />
</httpErrors>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
<httpCookies httpOnlyCookies="true" requireSSL="false" />
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FirstDataGlobalGatewayE4">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://api.xxxxxxxxxx.firstdata.com/transaction/v11"
binding="basicHttpBinding" bindingConfiguration="FirstDataGlobalGatewayE4"
contract="FirstDataService.ServiceSoap" name="FirstDataGlobalGatewayE4" />
</client>
</system.serviceModel>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true" />
</runtime>
</configuration>
Below give the web.config file in WCF service.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.diagnostics>
<sources>
<source propagateActivity="true" name="System.ServiceModel" switchValue="Warning,ActivityTracing">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="c:\tfslatest\entermarkets\project specific\psbd\trunk\smartincident\pss.web.services.internal\web_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
</system.diagnostics>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<!-- -->
<!-- *** DATABASE *** -->
<!-- -->
<add key="Db Timeout Seconds" value="200" />
<add key="Enable SMS" value="true" />
<add key="Enable Notification" value="true" />
<add key="K2 Server" value="EM-K2" />
<add key="Forgot Password External Url" value="http://localhost/PSS.Web/ResetPassword.aspx?id=" />
<add key="Incident Mobile Download Url" value="http://localhost/PSS.Web/DownloadApp.aspx?id=" />
</appSettings>
<system.web>
<compilation targetFramework="4.5" debug="true" />
<httpRuntime maxRequestLength="2097151"
useFullyQualifiedRedirectUrl="true"
executionTimeout="14400" />
</system.web>
<system.serviceModel>
<bindings>
<webHttpBinding>
<binding name="AttachmentService"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" transferMode="Streamed" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="BasicHttpBinding_INotificationService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/Utility.Notification.Service/NotificationService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INotificationService" contract="INotificationService" name="BasicHttpBinding_INotificationService" />
<endpoint address="http://localhost/PSS.Web.Services.Internal/AttachmentService.svc" binding="basicHttpBinding"
bindingConfiguration="AttachmentService"
contract ="IAttachmentService">
</endpoint>
</client>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<!--<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>-->
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<!--<directoryBrowse enabled="true" />
<security>
<authentication>
<windowsAuthentication enabled="true" />
</authentication>
</security>-->
<directoryBrowse enabled="true" />
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" maxUrl="2147483648" maxQueryString="2147483648" />
</requestFiltering>
</security>
</system.webServer>
<connectionStrings>
<add name="Conn_PSBDDb" connectionString="DATA SOURCE=192.168.0.100:1521/orcl;USER ID=PSBD;Password=password*1;" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>
</configuration>
This is Server Side Config Files
<?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>
<!-- -->
<!-- *** PLUG-IN CONFIGURATION *** -->
<!-- -->
<!-- Plug-In Collection -->
<!-- Format for each entry is <Type>#<Assembly> -->
<add key="AD Authentication PlugIn Evaluation List" value="PSS.AD.Adapters.NonMemberServer.NonMemberServerManager#PSS.AD.Adapters.NonMemberServer" />
<add key="Login Url" value="http://localhost/PSS.Web/Login.aspx" />
<add key="Forgot Password External Url" value="http://localhost/PSS.Web/ResetPassword.aspx?id=" />
<add key="Incident Mobile Download Url" value="http://localhost/PSS.Web/DownloadApp.aspx?id=" />
<add key="PSS Url" value="http://localhost/PSS.Web/" />
<!--<add key="Templates Url" value="C:\TFS\EnterMarkets\Project Specific\PSBD\Trunk\SmartIncident\PSS.Web.Services.Internal\bin\MessageTemplates" />-->
<add key="Templates Url" value="\\192.168.0.243\psbd\PSS.Web.Services.Internal\bin\MessageTemplates" />
<add key="Hyper Pay URL" value="https://test.oppwa.com/" />
<add key="Hyper Pay UserId" value="8a829417527905e80152794f55950197" />
<add key="Hyper Pay Password" value="e2XRrKJa" />
<add key="Hyper Pay EntityId" value="8a829417527905e80152794f8af10199" />
<add key="Hyper Pay PaymentType" value="DB" />
<!--For testing it must be 'EXTERNAL' else change to 'INTERNAL' as per documentation-->
<add key="Hyper Pay Test Mode" value="EXTERNAL" />
<!-- -->
<!-- *** DATABASE ** * -->
<!-- -->
<add key="Db Timeout Seconds" value="200" />
<!-- -->
<!-- *** LOGGING *** -->
<!-- -->
<add key="EnableLogging" value="false" />
<add key="LogFilePath" value="C:\Temp\Logs\PSS.Web.log" />
<add key="Enable SMS" value="true" />
<add key="Enable Notification" value="true" />
<add key="Domain Name" value="coruscant" />
<add key="EnableExamExecution" value="false" />
<!--
If "EnableLogging" is set to true, this integer
specifies the max size in bytes which the log file can be until it will
be purged on next write to the log file
Default value: 100000000
-->
<add key="Attachment Plug-In List" value="PSS.Core.Attachment.Adapters.FileServer.FileServerManager#PSS.Core.Attachment.Adapters.FileServer" />
<add key="MaxLogFileSize" value="100000000" />
<!-- Event Log Logging -->
<add key="EventLogSourceName" value="PSS.Web" />
<add key="ClientSettingsProvider.ServiceUri" value="" />
<add key="language" value="ar" />
<add key="FilestorePath" value="C:\Filestore\" />
<!--Phisical Paths-->
<add key="C:\TFS\EnterMarkets\Project Specific\PSBD\Trunk\SmartIncident\PSS.Web" value="" />
<add key="UploadedFiles" value="C:\TFS\EnterMarkets\Project Specific\PSBD\Trunk\SmartIncident\PSS.Web\UploadedFiles\" />
<!--/Phisical Paths-->
</appSettings>
<system.web>
<customErrors mode="Off" defaultRedirect="~/ErrorPage.aspx" redirectMode="ResponseRewrite"></customErrors>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime maxRequestLength="2097150"/>
</system.web>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483647" />
</webServices>
</scripting>
</system.web.extensions>
<connectionStrings>
<add name="Conn_PSBDDb" connectionString="DATA SOURCE=192.168.0.100:1521/ORCL;USER ID=PSBD;Password=password*1;" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings><!---->
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" maxUrl="2147483648" maxQueryString="2147483648" />
</requestFiltering>
</security>
<!--<modules runAllManagedModulesForAllRequests="true">
<remove name="BundleModule" />22
<add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>-->
<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>
<staticContent>
<!--
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".svgz" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/otf" /> -->
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
<remove fileExtension=".mp4" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<!--
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
<mimeMap fileExtension=".ipa" mimeType="application/octet-stream" /> -->
</staticContent>
<directoryBrowse enabled="true" />
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IADService" />
<binding name="BasicHttpBinding_IWorkFlowService" />
<binding name="BasicHttpBinding_INotificationService" />
<!--<binding name="BasicHttpBinding_IAttachmentService" />-->
<binding name="BasicHttpBinding_IAttachmentService" closeTimeout="04:01:00" openTimeout="04:01:00" receiveTimeout="04:10:00" sendTimeout="04:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true">
<readerQuotas maxDepth="128" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.0.245/PSS.AD.Web.Services/ADService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IADService" contract="ADWebService.IADService" name="BasicHttpBinding_IADService" />
<endpoint address="http://192.168.0.242/PSS.Web.Services.Internal/WorkFlowService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWorkFlowService" contract="PSSWorkFlowService.IWorkFlowService" name="BasicHttpBinding_IWorkFlowService" />
<endpoint address="http://localhost/Utility.Notification.Service/NotificationService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INotificationService" contract="INotificationService" name="BasicHttpBinding_INotificationService" />
<endpoint address="http://localhost/PSS.Web.Services.Internal/AttachmentService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAttachmentService" contract="AttachmentsService.IAttachmentService" name="BasicHttpBinding_IAttachmentService" />
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
I am unable to upload more the 50KB file, less than 50kb is working fine the exception I am getting is (The remote server returned an unexpected response: (400) Bad Request.). Any help could be appreciated. Thanks!!
After deploy my ASP.NET 4.5 Web Forms site under IIS7 I got error that didn't have when run from VS2013.
The errors on browsing my site from firebug:
"NetworkError: 404 Not Found - h t t p://wcfjsproxydemo/bundles/modernizr?v=Vd40cG5fYxxjdknf_y9ilK-zi7pnjL35tk9IAsOQgQc1"
modern...sOQgQc1
"NetworkError: 404 Not Found - h t t p://wcfjsproxydemo/Content/css?v=f5ydPh92LWsttS1MEc8JZmFtAgT6RUaer_jy37xBkQs1"
css?v=...7xBkQs1
"NetworkError: 404 Not Found - h t t p://wcfjsproxydemo/bundles/MsAjaxJs?v=J4joXQqg80Lks57qbGfUAfRLic3bXKGafmR6wE4CFtc1"
MsAjax...E4CFtc1
"NetworkError: 404 Not Found - h t t p://wcfjsproxydemo/bundles/WebFormsJs?v=q9E9g87bUDaS624mcBuZsBaM8xn2E5zd-f4FCdIk2cA1"
WebFor...dIk2cA1
TypeError: Sys.WebForms is undefined
...bForms.PageRequestManager._initialize('ctl00$ctl08', 'ctl01', [], [], [], 90, 'c...
wcfjsproxydemo (line 67)
POST http://intext.nav-links.com/util/intexteval.pl?op=eval&x=3&xop=eval&rnum=911043
200 OK
214ms
intext...inks=3& (line 3039)
I see my site without style.
What should I change here in my site?
my web.config
<?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>
<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=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WCFJSproxyDemo-20130722004707;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WCFJSproxyDemo-20130722004707.mdf" />
</connectionStrings>
<system.web>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<pages>
<namespaces>
<add namespace="System.Web.Optimization" />
</namespaces>
<controls><add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /></controls></pages>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" defaultUrl="~/" />
</authentication>
<profile defaultProvider="DefaultProfileProvider">
<providers>
<add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.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=1.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=1.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=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
</providers>
</sessionState>
</system.web>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" />
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WCFJSproxyDemo.Service.WCFJSproxyDemoBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="WCFJSproxyDemo.Service.DemoWCFService">
<endpoint address="" behaviorConfiguration="WCFJSproxyDemo.Service.WCFJSproxyDemoBehavior" binding="webHttpBinding" contract="WCFJSproxyDemo.Service.IDemoWCFService">
</endpoint>
</service>
</services>
</system.serviceModel>
<system.webServer>
<defaultDocument>
<files>
<remove value="default.aspx" />
<remove value="iisstart.htm" />
<remove value="index.html" />
<remove value="index.htm" />
<remove value="Default.asp" />
<remove value="Default.htm" />
<add value="TestWCFService.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
I fixed it.
After some hours working in this issue I found a blog with just one think to do:
<modules runAllManagedModulesForAllRequests="true">
<remove name="BundleModule" />
<add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>
Optimization.cs
bundles.Add(new StyleBundle("~/Static/css/stylesheets.css")
.Include(
"~/Static/stylesheets/base.css",
"~/Static/stylesheets/layout.css"
)
);
bundles.Add(new ScriptBundle("~/Static/js/script.js")
.Include("~/Static/js/jquery.refineslide.min.js",
"~/Static/js/script.js"));
Root.Master
<asp:ContentPlaceHolder ID="cssBundle" runat="server">
<%= System.Web.Optimization.Styles.Render("~/Static/css/stylesheets.css") %>
</asp:ContentPlaceHolder>
.
.
.
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<%= System.Web.Optimization.Scripts.Render("~/Static/js/script.js") %>
</asp:ContentPlaceHolder>
In ASP.net forms,
Just you have to change modules in webconfig to the below
<modules runAllManagedModulesForAllRequests="true">
<remove name="BundleModule" />
<add name="BundleModule" type="System.Web.Optimization.BundleModule" />
</modules>
I am trying to build a web service that cal handle Double Hop Delegate / impersonation. End goal is to have a Web Site, that can make a Web Service call to a Custom Sharepoint Web Service as a particular user (instead of using a specific user in an AppPool) and get a list of files in a particular folder on SharePoint that this user has access to. That way when our website makes the call as that user, we only retrieve the files they have access to.
The issue I am having right is that as I have read already, ASP.NET calls to a WCF service cannot by default pass the token information along (the Double Hop affect). I have been trying several tutorials on how to get around this security and have been unsuccessful so far.
Here is my Service Web.Config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<!--<serviceAuthorization impersonateCallerForAllOperations="true"/>-->
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Service GetData Call
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
public string GetData(int value)
{
if (HttpContext.Current == null)
{
return "Failed to impersonate";
}
return string.Format("Your name is: " + WindowsIdentity.GetCurrent().Name + "... You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
I have tried adding the ASPNet Compatability MetaData, removing it to no avail.
ASP.NET MVC Web.Config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<identity impersonate="true"/>
<authentication mode="Windows">
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<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"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<basicHttpBinding>
<binding name="winAuthBasicHttpBinding" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://se-sandbox-dev/GreggColeman/WebServices/WCFDelegation/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="winAuthBasicHttpBinding"
contract="ServiceReference1.IService1" name="BasicHttpBinding_IService1" />
</client>
</system.serviceModel>
</configuration>
MVC Home Controller
using (((WindowsIdentity)User.Identity).Impersonate())
{
ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
client.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Delegation;
returnData = client.GetData(5);
ViewBag.Message = returnData;
}
Every time, I either Get WindowsIdentity is equal to whatever the AppPool is set to OR the HTTPContext = null. Neither ever have t he correct data unless I use a Windows Application. Then it works fine. Any Help would be greatly appreciated