2008年2月22日 星期五
db_owner 與 database owner
2008年2月20日 星期三
fire stored procedure and forget
Ado.net 好像沒有一個 ExecuteNoneQueryWithoutWaiting 的指令哦!
�好,SQL Server 2005 有一些功能。
建立一個Job,讓�Job 跑此stored procedure做為第一個 step。 再以 ado.net 執行此 stored procedure 即可。
EXEC msdb.dbo.sp_start_job @job_name = 'JobName'
2008年2月15日 星期五
Could not find a base address that matches scheme https for the endpoint with binding WSHttpBinding. Registered base address schemes are [http]
奇怪的是,我是使用 http://localhost/service/service.svc 來測試的,為何一直有 https 的出現呢?
設定如下:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WindowsBinding">
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="IssueTracking.IssueServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<windowsAuthentication includeWindowsGroups="true" allowAnonymousLogons="false" />
</serviceCredentials>
<serviceAuthorization />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="IssueTracking.IssueServiceBehavior"
name="IssueTracking.IssueService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WindowsBinding"
contract="IssueTracking.IIssueService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
後來,google 了很久,才漸漸覺的,這是微軟的設計。因為 web service 是不安全的,因此會要求走 SSL。
因此,改走 basciHttpBinding ,並改成<security mode="TransportCredentialOnly">
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="IssueTracking.IssueServiceBehavior">
<serviceMetadata httpGetEnabled="true"
httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<windowsAuthentication includeWindowsGroups="true" allowAnonymousLogons="false" />
</serviceCredentials>
<serviceAuthorization />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="IssueTracking.IssueServiceBehavior"
name="IssueTracking.IssueService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicBinding"
contract="IssueTracking.IIssueService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
就ok 了
Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
2008年2月14日 星期四
IIS 7.0 上的 Windows Authentication
HTTP Error 404.3 - Not Found
Server Error in Application "Default Web Site/IssueTracking"
--------------------------------------------------------------------------------
HTTP Error 404.3 - Not Found
Description: The page you are requesting cannot be served because of the Multipurpose Internet Mail Extensions (MIME) map policy that is configured on the Web server. The page you requested has a file name extension that is not recognized, and is not allowed.
Error Code: 0x80070032
Notification: ExecuteRequestHandler
Module: StaticFileModule
Requested URL: http://localhost:80/IssueTracking/IssueService.svc
Physical Path: C:\Users\charles.BANKPRO\Documents\Visual Studio 2008\Projects\IssueTracking\IssueTracking\IssueService.svc
Logon User: Anonymous
Logon Method: Anonymous
Handler: StaticFile
Most likely causes:
原因是我在安裝Vista時,尚未安裝 IIS 7.0,就先裝了 VS2008。因此,得必須自己手動註冊資訊。
除了 aspnet_regiis -i 外 (for asp.net 2.0)
也必須到
c:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation>ServiceModelReg -i
2008年2月5日 星期二
自訂 AutoCompleteExtender

使用 AutoCompleteExtender時,如果要像Google Search 之 tips 效果,要怎麼做呢?
重點是,預設之AutoCompleteExtender,會將所有的 text,全部設定到 textbox 上。
找AutoCompleteExtender 之 AutoCompleteBehavior.js 可以找到下面這一段。
_setText: function(text) { this._timer.set_enabled(false);
this._currentPrefix = text;
var element = this.get_element();
var control = element.control;
// todo: should check for 'derives from' too and should somehow manually cause TB to raise property changed event
if (control && control.set_text)
{
control.set_text(text);
}
else { element.value = text; }
this._hideCompletionList();
},
可以發現,是有機會 override set_text 的。
google 一下後,找到了 solution
function pageLoad() {
AjaxControlToolkit.AutoCompleteBehavior.prototype._setText = function(item) {
var text = item.split(" ")[0];
this.get_element().value = text;
}
}
此會將找到的字串之第一段空白前的文字,塞到 textbox 中。