Showing posts with label IIS7. Show all posts
Showing posts with label IIS7. Show all posts

Thursday, 11 April 2013

Visual Studio 2012 XML IntelliSense for URL Rewrite 2.0

Problem:
I am working on a web-project within VS2012. I was trying to implement url-rewriting as described at cache busting in ASP.NET by Mads Kristensen. I was running into the problem that VS2012 didn't recognize the tag inside the .
I got it to work/function (thanks to ScottGu's blogpost) after installing the URL Rewrite Extension on IIS7.x.
So far so good, but VS2012 intellisense still didn't recognize the tag.
Solution:
I searched around and found the post http://ruslany.net/2010/04/visual-studio-xml-intellisense-for-url-rewrite-2-0/ on RuslanY Blog. Unfortunately, the script didn't work on VS2012. Even changing a part of the code to var vs9CommonTools = shell.ExpandEnvironmentStrings( “%VS110COMNTOOLS%” );
However, a guy named Michal A. Valášek created an updated js script to get it to work on VS2012.
So I put the pieces together for your convenience, you can download it here (I called it rewrite2.1_vsintellisense). Note this script is just for VS2012! Just unpack the zip file, run the commandline window as administrator (elevated privileges), and execute the script file with cscript UpdateSchemaCache.js
Happy programming!

Wednesday, 19 September 2012

Cross-domain data with AJAX using JSON

I read some different blogs and sites about using JSON or JSONP in relation with AJAX requests in cross-domain environments.
I just want it to keep it as simple as possible.
Situation:
I have a local webservice, behind a firewall, which is only available from another website somewhere on the internet (ip-filtering). On that site I call the (local) webservice) using
$.ajax({
  type: "POST",
  url: 'http://<my url:portnumber>/myCustomService.asmx/SendMyRequest',
  data: "{name: '" + _name
  + "' , category: '" + _category
  + "' , address: '" + _address
  + "' , company: '" + _company + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
  // etc...

So, I figured out to use "access-control-allow-origin" with the value "*" as a custom header in IIS7.5
Problem:
However, adding the Acces-control-allow-origin=* doesn't work. After some struggling and some more research, in found the solution
Solution:
Besides this access-control-allow-origin, you need to add an extra entry, the "access-control-allow-headers" with value "content-type". So, just place inside your web.config the following data:

<configuration>
  <system.webServer>
    <httpProtocol>
      <customHeaders>
        <add name="access-control-allow-origin" value="*" />
        <add name="access-control-allow-headers" value="content-type" />
      </customHeaders>
    </httpProtocol>
  </system.webServer>
</configuration>

Wednesday, 5 October 2011

MOSS 2007 - Upload size and HTTP-error 404.13

Today I discovered a strange behaviour of MOSS 2007 in combination with IIS 7. Normally you set the maximum upload size on web application level, inside the central administration. Guess what, that doesn't work at all when you are running MOSS 2007 on a IIS 7. You will raise into a "HTTP-error 404.13 Not Found". Thanks to internet, I found the solution (it worked for me, so give it a try).

Solution 1 - Changes for all web sites:
Next statement will set the maximum file upload size to 100MB. Note: the maxAllowedContentLength is in bytes!
%windir%\system32\inetsrv\appcmd set config -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
Solution 2 - Changes for a web app:

%windir%\system32\inetsrv\appcmd set config "Default Web Site/" -section:requestFiltering -requestLimits.maxAllowedContentLength:104857600
Just execute the statement in a command prompt.