To enable SSI in IIS Express, open configuration file:
C:\Users\%user%\Documents\IISExpress\config\applicationhost.config
and within it make sure that:
1) SSI is enabled - within "globalModules" section should be a tag: <add name="ServerSideIncludeModule" image="%IIS_BIN%\iis_ssi.dll" />
2) set a default document with "shtml" - within "defaultDocument" section add e.g. <add value="index.shtml" />
One more thing to note about SSI files. I was struggling a lot with includes breaking my page layout - adding empty line in every spot where #include was used. Apparently the problem is with encoding of the file. So instead of using "Unicode (UTF-8 with signature)", save your include files with "Unicode (UTF-8 without signature)" - in visual studio you can set this in menu File -> Advanced Save Options...
Saturday, May 25, 2013
Sunday, December 04, 2011
WorkItem only view in TFS 2010 Web Access
Here is an excellent how-to. It covers the very simple scenario as well as more complex approach (in case you need to deal with multiple customers and need more granual settings).
However, there's one glitch that is not mentioned there. TFS has a nasty habit of not picking up domain changes right-away. So if you just created the user & group in your domain, set everything up according to the how-to, you may end up with an error:
Access Denied: {your user} needs the following permission(s) to perform this action: View instance-level information
There's a thread describing the issue. In essence you have a choice of:
However, there's one glitch that is not mentioned there. TFS has a nasty habit of not picking up domain changes right-away. So if you just created the user & group in your domain, set everything up according to the how-to, you may end up with an error:
Access Denied: {your user} needs the following permission(s) to perform this action: View instance-level information
There's a thread describing the issue. In essence you have a choice of:
- wait for a bit (30 minutes or so) and TFS will pick it up eventually
- restart the TFS server
- instead of using group, use user credentials directly (probably not the best option though)
Saturday, December 03, 2011
Adding Facebook comments to blog
I've decided to try and utilize Facebook Comments Plugin for my travel blog application (ASP.Net). At first glance it seemed like a job for 5 minutes, however it proved to be quite a tricky experience. I had following requirements:
To get started, follow this tutorial (post #11). In essence, you need to set up Facebook Application using following steps:
1. Go to: http://www.facebook.com/developers
2. Click on the + Set Up New App button (at the top right of the page)
3. Type your App Name (example: Mysite-Name Comments) > select Agree > click on Create App
4. Go to the Web Site tab (on the left tabs-list)
5. Enter your site url with an ending slash in Site URL, (for example: http://example.com/)
Enter your site domain without http://www. in Site Domain, (for example: example.com)
and click on Save Changes
6. You will see your Application ID number (above your app API Key & App Secret)
7. It will take between 2 to 20 minutes until it will be ready to use with.
Use this page to see the list of your applications.
Now that you have you aplication set up and you have the application ID, it's time to set up the security settings. Comments left on for your application can be moderated here - and here using the Settings link you can also adjust the security settings.
Final step is to generate the required code for your page. Use the Comments Tool for that. The top part with generated script is NOT COMPLETE! You do need to register the Javascript SDK - I recommend using the script on that page instead of the one from comment tool (in step 1). Step 2 gives you the DIV element which contains the comments box itself - works like a charm and yes, you can use href with different querystrings.
There are couple of new features that you can read about in this blog post.
You are very close to being done, however there are couple more settings that you should add to your page's header tag. Details are described n the Open Graph Protocol documentation in the Getting Started section. Finally you should add following tag:
meta property="fb:app_id" content="YOUR-APP-ID"
That will ensure that your moderators will be able to do in-place moderating (i.e. the plugin shows them the "moderate" option)
Use Facebook Debugger to see what settings your page uses and if there's anything that needs your attention.
- need to be able to display multiple comments sections per page (since I have 10 blog-posts on each page and each post needs to have its own comments) that need to be distinguishable by querystring parameters
- need to have a way of calculating how many comments there are for each post
- would love to have a way of being able to get latest X comments across all the whole site (i.e. irregardless which blog-post they belong to)
To get started, follow this tutorial (post #11). In essence, you need to set up Facebook Application using following steps:
1. Go to: http://www.facebook.com/developers
2. Click on the + Set Up New App button (at the top right of the page)
3. Type your App Name (example: Mysite-Name Comments) > select Agree > click on Create App
4. Go to the Web Site tab (on the left tabs-list)
5. Enter your site url with an ending slash in Site URL, (for example: http://example.com/)
Enter your site domain without http://www. in Site Domain, (for example: example.com)
and click on Save Changes
6. You will see your Application ID number (above your app API Key & App Secret)
7. It will take between 2 to 20 minutes until it will be ready to use with.
Use this page to see the list of your applications.
Now that you have you aplication set up and you have the application ID, it's time to set up the security settings. Comments left on for your application can be moderated here - and here using the Settings link you can also adjust the security settings.
Final step is to generate the required code for your page. Use the Comments Tool for that. The top part with generated script is NOT COMPLETE! You do need to register the Javascript SDK - I recommend using the script on that page instead of the one from comment tool (in step 1). Step 2 gives you the DIV element which contains the comments box itself - works like a charm and yes, you can use href with different querystrings.
There are couple of new features that you can read about in this blog post.
You are very close to being done, however there are couple more settings that you should add to your page's header tag. Details are described n the Open Graph Protocol documentation in the Getting Started section. Finally you should add following tag:
meta property="fb:app_id" content="YOUR-APP-ID"
That will ensure that your moderators will be able to do in-place moderating (i.e. the plugin shows them the "moderate" option)
Use Facebook Debugger to see what settings your page uses and if there's anything that needs your attention.
Monday, July 04, 2011
Getting Could not load file or assembly App_Web for SVC
I have couple of SVC services within an ASP.Net 4.0 website. All works fine with some hiccups (see my previous posts about issues with naming, etc.), but then I started getting errors again when accessing them (500 internal server error). So I investigated what's happening and found out that services are not working and returning:
asp.net svc could not load assembly App_Web...
What the heck? All worked fine and all I did was to add some assembly references to web.config. Turns out that compilation tag may cause this issue - and solution is:
set the "batch" attribute of the "compilation" tag in web.config to "false.
Sunday, June 12, 2011
Getting 400 Bad Data when using svc for AJAX calls
You may run into problems when using WCF service for AJAX calls. I've described how to use it in this post. Turns out, there's one small thing in configuration, that can cause all sorts of problems.
I've named the service "MyService.svc". Registered everything, configured in web.config, but I was still getting errors during load - essentially the ".../MyService.svc/js" (or ".../jsdebug" in debug mode) was returning 400 Bad Data error.
I've finally pinned the problem to web.config setting - the name attribute of the service has to match the class name.
So this is wrong:
<service name="aaaMyService">
...
And this is correct:
<service name="MyService">
Saturday, April 16, 2011
Ajax SVC getting 404 error when using https
We're using AJAX WCF service for javascript calls.
All worked well while we were running under http, but when we went to production and switched to https, all of a sudden service wasn't workin. Following was happening:
http://mytest.com/test.svc/js - worked fine
https://mytest.com/test.svc - worked fine
https://mytest.com/test.svc/js - 404 error
Turned out we were missing binding configuration for https. This blogpost describes how to fix it (i'm attaching the XML fragment just in case the blog goes missing...)
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="TestServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="TestService">
<endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
Tuesday, March 15, 2011
Calling OperationContract in SVC using JavaScript
I was attempting to use WebMethod in a masterpage. Since .Net doesn't support static inheritance, I was out-of-luck. The obvious alternative was to use web-service to do the job. Since I was using .net 4.0, I was hoping to utilize the SVC and not ASMX.
Here's how you can make it work:
1) add "myservice1.svc" using the "Add New Item" -> "AJAX-enabled WCF-Service" menu. Notice that it adds section to your web.config and also "myservice1.cs" into your App_Code.
2) create your method in the "App_Code/myservice1.cs" (sample method below). Warning! If you're using Web Site project as me, don't put anything in the ServiceContract's Namespace!
[OperationContract]
public void SampleMethod1(int param1)
{
// your code here
}
3) Next step is to register this service in your ScriptManager (in my case, I have it on my master page):
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/myservice1.svc" />
</Services>
</asp:ScriptManager>
4) Finally JavaScript that will call the method:
myservice1.SampleMethod1(2);
It's really that simple - the ScriptManager makes the "myservice1" available and you just call the methods. Again, please note that there's no namespace.
Subscribe to:
Posts (Atom)