How to remove a windows service
- September 10th, 2011
- By Germán Medina
- Write comment
sc delete “Service Name”
Author Archive
sc delete “Service Name”
This code will populate a date/time table for a cube or any other purpose in SQL Server.
declare @start datetime, @end datetime, @date datetime, @hour int select @start = '2011-08-01 00:00', @end = '2013-01-01 00:00' set @date = @start while @date < @end begin set @hour = 0 while @hour < 24 begin insert into [date]([id], yeardate, monthdate, daydate, hourdate,[year], [month], [day], [hour]) values( ltrim(datepart(year, @date)) + '-' + ltrim(datepart(month, @date)) + '-' + ltrim(datepart(day, @date)) + ' ' + str(@hour) + ':00', ltrim(datepart(year, @date)) + '-01-01 00:00', ltrim(datepart(year, @date)) + '-' + ltrim(datepart(month, @date)) + '-01 00:00', ltrim(datepart(year, @date)) + '-' + ltrim(datepart(month, @date)) + '-' + ltrim(datepart(day, @date)) + ' 00:00', ltrim(datepart(year, @date)) + '-' + ltrim(datepart(month, @date)) + '-' + ltrim(datepart(day, @date)) + ' ' + str(@hour) + ':00', datepart(year, @date), datepart(month, @date), datepart(day, @date), @hour) set @hour = @hour + 1; end set @date = dateadd(day, 1, @date) end
This query will retrieve the rounded (2) size (MB) of all your tables on a SQL Azure database.
select
sys.objects.name,
cast(round(sum(reserved_page_count) * 8.0 / 1024, 2) as float) as size
from
sys.dm_db_partition_stats,
sys.objects
where
sys.dm_db_partition_stats.object_id = sys.objects.object_id
group by
sys.objects.name
order by
size desc
Linux Integration Services Version 2.1 now has support for Timesync, Integrated Shutdown and Symmetric Multi-Processing (SMP) up to 4 virtual processors.
ALTER DATABASE database SET RECOVERY SIMPLE; dbcc shrinkfile (database_log, 1); ALTER DATABASE database SET RECOVERY FULL;
1. Enable SSL configuration on your site
2. Set your binding security mode to Transport.
3. Set you service behavior serviceAuthorization PrincipalPermissionMode to None.
public class ServiceHostFactory : WebServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
ServiceHost host = new ServiceHost(typeof(Services), baseAddresses);
host.Authorization.PrincipalPermissionMode = PrincipalPermissionMode.None;
ServiceEndpoint endpoint = host.AddServiceEndpoint(typeof(IServices), new WebHttpBinding(WebHttpSecurityMode.Transport), "");
endpoint.Behaviors.Add(new WebHttpBehaviorEx());
return host;
}
}
1. C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis –i
2. C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe –i
3. Do all the things you normally do on IIS7, you are all set.
One of the biggest problems you will have while implementing RESTful services is that most of today’s browsers and firewalls will not allow PUT and DELETE requests. An easy way to fix this is to add a custom HTTP header to your post requests and send the real method in there. Since Google is using “X-HTTP-Method-Override” it looks like a smart choice to follow that pattern and use it too.
This simple jquery code shows how to do it in the client side:
$.ajax({
type: "POST",
url: serviceURL,
data: "data",
success: function(data, textStatus) { alert("success"); },
error: function(xhr, status, error) { alert("error"); },
beforeSend: function(xhr) { xhr.setRequestHeader("X-HTTP-Method-Override", "DELETE"); }
});
This C# code shows how to use the custom header in a WCF server:
public String PostProxy(String data)
{
switch (HttpContext.Current.Request.Headers["X-HTTP-Method-Override"])
{
case "PUT": return Add(data);
case "DELETE": return Delete(data);
default: return Update(data);
}
}
If you need to receive files bigger than 4MB using WCF services you have to change the default configuration in your web.config file to allow the size required.
<system.web> <httpRuntime maxRequestLength="131072" /> </system.web>
Note: this should work for any ASP application.