我有一个查询来获取2个日期时间之间的日期差异:
SELECT DATEDIFF(DAY, @CreatedDate , GETDATE())
Ex :
SELECT DATEDIFF(DAY, '2013-03-13 00:00:00.000' , GETDATE())
Run Code Online (Sandbox Code Playgroud)
我需要有一个这样的查询工作,它将从创建日减去一天:
SELECT DATEDIFF(DAY, **@CreatedDate- 1** , GETDATE())
Run Code Online (Sandbox Code Playgroud) 我为我的WCF服务创建了2个端点.
它工作正常,basicHttpBinding
但导致错误webHttpBinding
.
错误=未找到端点.
运营合同定义
[OperationContract]
[WebInvoke(Method = "POST",
BodyStyle = WebMessageBodyStyle.WrappedRequest,
ResponseFormat = WebMessageFormat.Json)]
VINDescription CallADSWebMethod(string vin, string styleID);
Run Code Online (Sandbox Code Playgroud)
web.config
:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="Description7aBinding" 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="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://services.chromedata.com:80/Description/7a"
binding="basicHttpBinding"
bindingConfiguration="Description7aBinding"
contract="description7a.Description7aPortType"
name="Description7aPort"/>
</client>
<services>
<service behaviorConfiguration="asmx" name="ADSChromeVINDecoder.Service">
<endpoint name="httpEndPoint"
address=""
binding="basicHttpBinding"
contract="ADSChromeVINDecoder.IService"/> …
Run Code Online (Sandbox Code Playgroud) 我在这个函数中遇到了很多不同的问题:
public static bool UploadToFTP(string strFileName, string strFolderName)
{
bool isUploaded = false;
string strFilename = string.Empty;
string strFtpURI = string.Empty;
string strFtpUserId = string.Empty;
string strFtpPassword = string.Empty;
byte[] buffer = null;
FileInfo oFileInfo = null;
FileStream oFileStream = null;
FtpWebRequest oFtpWebRequest = null;
try
{
strFilename = strFileName;
oFileInfo = new FileInfo(strFilename);
strFtpURI = Constants.FtpUri;
strFtpUserId = Constants.FtpUserID;
strFtpPassword = Constants.FtpPassword;
oFtpWebRequest = (FtpWebRequest)FtpWebRequest.Create(new Uri(strFtpURI + "/" + strFolderName + "/" + oFileInfo.Name));
oFtpWebRequest.Credentials = new NetworkCredential(strFtpUserId, strFtpPassword); …
Run Code Online (Sandbox Code Playgroud) 我的网站目前在ASP.NET 1.1中工作
旧过程
在我们的数据库中,我们存储了大量数据用于解码目的.我们必须每周更新这一大量数据表(数据来自供应商).
在我们的网站(在asp.net 1.1中),我们查询我们的数据库以解码信息.
新进程
现在,我们不是将数据存储在我们的数据库中并查询它们,而是希望通过Web服务替换它,AS现在供应商正在向我们提供DLL,它将为我们提供已解码的信息.
有关供应商提供的DLL的信息
提供的DLL只能添加到4.0站点中.那也实现了我不能直接将dll添加到我的1.1站点. 这个DLL暴露了某些方法,我们只需在我们的Web服务中添加DLL引用并调用该方法并获取所需的信息.
因此,我们不必将这些信息存储在我们的数据库中.
那么我应该使用哪种类型的Web服务(asmx或WCF)将使用供应商提供的DLL来获取解码信息?
我在网络服务中寻找的灵活性是:
注意:此外我们计划将我们的网站从asp.net 1.1迁移到4.0版本.所以它应该对未来的升级有很大的支持.
我已经开发了一个http处理程序来动态地提供图像..
我对每张图片都有相应的最后修改日期.
所以我已经实现了http头缓存,如下所示:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "image/jpeg";
DateTime lastModified = Convert.ToDateTime("2/1/2013 12:00:00 AM");
string eTag = "test.JPG" + lastModified.ToString();
// set cache info
context.Response.Cache.VaryByHeaders["If-Modified-Since"] = true;
context.Response.Cache.VaryByHeaders["If-None-Match"] = true;
context.Response.Cache.SetLastModified(lastModified);
context.Response.Cache.SetETag(eTag);
//Set cache control header
context.Response.Cache.SetCacheability(HttpCacheability.ServerAndPrivate);
Byte[] imageBytes = CreateImage();
context.Response.OutputStream.Write(imageBytes, 0, imageBytes.Length);
}
Run Code Online (Sandbox Code Playgroud)
注意:这里 将为每个图像动态获取lastModified,每个图像的名称也不同.
响应标题
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: image/jpeg
Last-Modified: Thu, 31 Jan 2013 18:30:00 GMT
Etag: test.JPG2/1/2013 12:00:00 AM
Vary: If-Modified-Since, If-None-Match
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?RTpcTGVhcm5pbmdcQ2FjaGVcR2V0SW1hZ2UuYXNoeA==?= …
Run Code Online (Sandbox Code Playgroud) 我正在使用sql server 2008
和网站在asp.net 1.1
.
有没有办法找出来how many times database has been called from a page
?
What are the stored procedure called from the page?
What are the tables involved in a page load?
Run Code Online (Sandbox Code Playgroud)
请建议我如何跟踪这些?
我有一个WCF Web服务,暴露3个端点.但是当我将它调试到WCF测试客户端时,它只显示一个basicHttpBinding端点.
1:为什么这样?
2:这里我有一个操作合同"CallADSWebMethod",它返回一个DataContract(VINDescription)..只是好奇地知道.. 为什么这对我来说非常适合实时但仍然不能被测试客户端测试 ..我的意思是测试客户端说"测试客户端不支持此操作"
3:这里的endpointBehaviors - 我只给出了没有...但它仍然是从jquery ajax调用工作.. 所以"enableWebScript"的意义是什么?
配置信息
<system.serviceModel>
<services>
<service behaviorConfiguration="asmx" name="ADSChromeVINDecoder.Service">
<endpoint address="basic"
binding="basicHttpBinding"
name="httpEndPoint"
contract="ADSChromeVINDecoder.IService"/>
<endpoint address="json"
binding="webHttpBinding"
behaviorConfiguration="webBehavior"
name="webEndPoint"
contract="ADSChromeVINDecoder.IService"/>
<endpoint contract="IMetadataExchange"
binding="mexHttpBinding"
address="mex" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="asmx">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
Run Code Online (Sandbox Code Playgroud) 我正在从 Web 服务调用发送如下的 ArrayList:
私有ArrayList testList = new ArrayList();
它将存储如下值:
"xyz (pound) (4545)"
"abc (in) (346)"
"def (off) (42424)"
Run Code Online (Sandbox Code Playgroud)
我使用它有两个原因:
1:我必须在 ASP.NET 1.1 框架中获取这个值。
2:我使用 testList.Sort(); 在发送之前。
但现在我想将这些值发送为:
"xyz" "pound" "4545"
"abc" "in" "346"
"def" "off" "42424"
Run Code Online (Sandbox Code Playgroud)
所以我找到了一种方法如下:
string[][] data = { new string[]{"xyz", "pound", "4545"},
new string[]{"abc", "in", "346"},
new string[]{"def", "off", "42424"}};
Run Code Online (Sandbox Code Playgroud)
问题是:我怎样才能有效地对其进行排序??或者有没有更好的方法来解决这个问题?
排序将基于第一个元素完成:
abc
def
xyz
Run Code Online (Sandbox Code Playgroud) 我有这个存储过程
ALTER PROCEDURE [dbo].[usp_mySP]
-- Add the parameters for the stored procedure here
-- For inventory table check.
@DealerID VARCHAR(50),
@Certified VARCHAR(50) = NULL,
-- For fuel value.
@CityFeatureValue VARCHAR(50),
@HwyFeatureValue VARCHAR(50)
AS
BEGIN
BEGIN
SELECT InventoryID,
VIN
FROM Inventory
WHERE DealerID = @DealerID
AND Deleted = 'False'
AND (IsPending = '0' OR IsPending IS NULL)
--AND (Certified = @Certified OR @Certified IS NULL)
AND VIN IN
(
SELECT VIN
FROM FuelPerformance
WHERE (
FeatureTitle = 'Fuel Economy (City)'
AND …
Run Code Online (Sandbox Code Playgroud) 我有一个 html 表格
<TABLE id="dlStdFeature" Width="300" Runat="server" CellSpacing="0" CellPadding="0">
<TR>
<TD id="stdfeaturetd" vAlign="top" width="350" runat="server"></TD>
</TR>
</TABLE>
Run Code Online (Sandbox Code Playgroud)
我动态地向其添加值:
function AddToTable(tblID, value)
{
var $jAdd = jQuery.noConflict();
var row= $jAdd("<tr/>").attr("className","lineHeight");
var cell = $jAdd("<td/>").attr({"align" : "center","width" : "3%"});
var cell1 = $jAdd("<td/>").html("<b>* </b>" + value);
row.append(cell);
row.append(cell1);
$jAdd(tblID).append(row);
}
Run Code Online (Sandbox Code Playgroud)
现在我想要一个函数,如果值匹配,则从该表中删除一行..as
function RemoveFromTable(tblID, VALUE)
{
If(row value = VALUE)
{
remove this row
}
}
Run Code Online (Sandbox Code Playgroud)
这里的 VALUE 是 TEXT ..需要匹配..如果存在需要删除该行,,
asp.net ×7
.net ×4
sql-server ×3
wcf ×3
c# ×2
asmx ×1
caching ×1
database ×1
datetime ×1
endpoint ×1
ftp ×1
html ×1
html-table ×1
http-headers ×1
httphandler ×1
javascript ×1
jquery ×1
performance ×1
sorting ×1
sql ×1
string ×1
web-services ×1