我有一些弹出消息框的代码:
MessageBox.Show(this,
"You have not inputted a username or password. Would you like to configure your settings now?",
"Settings Needed",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
Run Code Online (Sandbox Code Playgroud)
我的问题是当弹出我的应用程序通常最小化到托盘.因此,消息框不会出现在前面,也不会出现在起始栏中.看到它的唯一方法是通过alt-tabbing.
以下代码可以最小化我的应用程序(父级)到托盘:
if (FormWindowState.Minimized == WindowState)
{
Hide();
}
Run Code Online (Sandbox Code Playgroud) 我有以下路由代码:
routes.MapRoute(
"email-validated/{sessionId}",
"email-validated/{sessionId}",
new { controller = "User", action = "EmailValidated", sessionId = UrlParameter.Optional }
);
Run Code Online (Sandbox Code Playgroud)
当我点击路由w/url编码的东西时,它将与%2f,%2b和其他一些转义字符的路由不匹配.它也不匹配非url编码(事物w/+等)例如
这有效:
电子邮件验证/ XQiKC6KMM%2cmko4nOvzGRwPu9oaZFoCtXsFFJg3ZTf9S5rsBbLGjnz3FN3SJ0apEZcqK1PIcCY28mRMykB39XnFLKaL7390CDfLZiV77cso
这不起作用(包含%2f等):
email-validated/XQiKC6KMM%2fmko4nOvzGRwPu9oaZFoCtXsFFJg3ZTf9S5rsBbLGjnz3FN3SJ0apEZcqK1PIcCY28mRMykB39XnFLKaL7390CDfLZiV77cso
Run Code Online (Sandbox Code Playgroud)
这不起作用(包含+等)
email-validated/XQiKC6KMM+mko4nOvzGRwPu9oaZFoCtXsFFJg3ZTf9S5rsBbLGjnz3FN3SJ0apEZcqK1PIcCY28mRMykB39XnFLKaL7390CDfLZiV77cso
Run Code Online (Sandbox Code Playgroud) 我试图通过对C#的WebService调用来解析AS3中的一些XML.C#使用DataContract进行序列化,因此命名空间是非标准的.
这是xml的样子:
<User xmlns="http://schemas.datacontract.org/2004/07/UserDatabaseManipulation.POCO" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Email>
<EmailString>
bill@whitehouse.gov
</EmailString>
</Email>
<Password>
<PasswordPlainText>
password
</PasswordPlainText>
</Password>
<ReferralDetails>
<ReferralEmail/>
<ServiceCreatedAt>
google
</ServiceCreatedAt>
</ReferralDetails>
<UserDetails>
<Address>
Penn Ave
</Address>
<City>
Washington DC
</City>
<Country>
USA
</Country>
<FirstName>
Bill
</FirstName>
<LastName>
Clinton
</LastName>
<State>
AK
</State>
<Zip>
11111
</Zip>
</UserDetails>
</User>
Run Code Online (Sandbox Code Playgroud)
因此,您可以看到我有一个用户,其中包括电子邮件,密码,推荐详细信息和用户详细信息.
这是我解析它和问题的地方:
private function onResult(event:ResultEvent):void
{
var n:Namespace = new Namespace("http://schemas.datacontract.org/2004/07/UserDatabaseManipulation.POCO");
use namespace n;
//This WORKS! ResultXml is loaded with the correct looking XML.
var resultXml:XML = new XML(event.result);
//This doesnt work! I …Run Code Online (Sandbox Code Playgroud) 嗨,我有一个WCF Rest 4.0项目.出于某种原因,我有一个Web服务应该返回Json,如果我通过fiddler点击端点,但是通过firefox或chrome,如果我输入地址我得到xml.这是怎么回事???
谢谢你的帮助!这是代码.
有问题的网络服务:
[OperationContract]
[WebGet(UriTemplate = "",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
public SomeObject [] GetObjects()
{
.....
Run Code Online (Sandbox Code Playgroud)
对象代码:
[DataContract]
public class SomeObject
{
[DataMember]
public string Date { get; private set; }
....
public String Site { get; private set; }
Run Code Online (Sandbox Code Playgroud) 我有一个基本的buddylist类型的应用程序,它是WCF中的pub/sub交易.我的问题是一个或两个调用长时间运行,这会阻塞整个服务器应用程序(gui更新等).
这是我的代码:
[ServiceContract(SessionMode = SessionMode.Required,
CallbackContract = typeof(IBuddyListContract))]
public interface IBuddyListPubSubContract
{
[OperationContract]
string GetABunchOfDataZipped(String sessionId); // this can take > 20 seconds
....
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall,
ConcurrencyMode = ConcurrencyMode.Multiple)]
public class BuddyListPubSubContract : IBuddyListPubSubContract
{
string GetABunchOfDataZipped(String sessionId)
{
// do some calculations and data retrival
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
到目前为止,我对如何解决这个问题有了一个想法,但有一种更简单的方法吗?
想法1:让GetABunchOfDataZipped(String sessionId)成为一个空白,当它完成时,我的双工合同上有另一个端点,我点击它.我不喜欢这种情况,就好像我的架构发生了根本性的变化,如果字符串是通过慢速互联网连接的大块文本,它仍然会遇到同样的问题?
我正在使用WCF Web Api 4.0框架,并且运行到maxReceivedMessageSize已超过65,000错误.
我已经更新了我的webconfig看起来像这样,但因为我使用WCF Web Api我认为这已不再使用,因为我不再使用webHttpEndpoint了?
<standardEndpoints>
<webHttpEndpoint>
<!--
Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
via the attributes on the <standardEndpoint> element below
-->
<standardEndpoint name=""
helpEnabled="true"
automaticFormatSelectionEnabled="true"
maxReceivedMessageSize="4194304" />
</webHttpEndpoint>
Run Code Online (Sandbox Code Playgroud)
在新的WCF Web Api中,我在哪里指定MaxReceivedMessageSize?
我也试过CustomHttpOperationHandlerFactory无济于事:
public class CustomHttpOperationHandlerFactory: HttpOperationHandlerFactory
{
protected override System.Collections.ObjectModel.Collection<HttpOperationHandler> OnCreateRequestHandlers(System.ServiceModel.Description.ServiceEndpoint endpoint, HttpOperationDescription operation)
{
var binding = (HttpBinding)endpoint.Binding;
binding.MaxReceivedMessageSize = Int32.MaxValue;
return base.OnCreateRequestHandlers(endpoint, operation);
}
}
Run Code Online (Sandbox Code Playgroud) 嘿,超级新手问题.考虑以下WCF函数:
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class Service1
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
[WebInvoke(UriTemplate = "",
Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare) ]
public SomeObject DoPost(string someText)
{
...
return someObject;
Run Code Online (Sandbox Code Playgroud)
在小提琴手中,我的请求标题和正文会是什么样子?
谢谢您的帮助.
我正在使用一个C#应用程序,它使用EasyHook库进行DLL注入.EasyHook要求使用它的任何应用程序都有很强的名称.为了强烈命名应用程序,我需要确保我使用的所有库都具有强名称.
这对我的所有托管库都很容易,但我还有一个非托管的c ++库,我需要强烈命名.经过一些搜索,我似乎无法找到一种方法来签署我的非托管DLL,即使使用源代码也是如此.可以这样做,如果是这样,我还需要做什么?
感谢您的任何建议或帮助!
已经有一段时间了,只是不能让谷歌接受我已经完成了他们想要的东西,所以他们不断向我发送同一订单的通知.有关此文档的文档可在此处获得:
这是我的页面上的代码收到谷歌通知:
string serial = Request["serial-number"];
// do my stuff
StringBuilder responseXml = new StringBuilder();
responseXml.Append("<?xml version='1.0' encoding='UTF-8'?>");
responseXml.Append("<notifiation-acknowledgment xmlns=\"http://checkout.google.com/schema/2/\" serial-number=\"");
responseXml.Append(Request["serial-number"]);
responseXml.Append("\" />");
HttpResponse response = HttpContext.Current.Response;
response.StatusCode = 200;
response.ContentType = "text/xml";
response.Write(responseXml.ToString());
Run Code Online (Sandbox Code Playgroud) 我有一些SQL将javascript日期转换为SQL日期,效果很好.但是,我已经遇到了一些太大而导致异常的数据:
将表达式转换为数据类型int的算术溢出错误
这是有问题的SQL:
DATEADD(MILLISECOND, cast(569337307200000 as bigint) % 1000, DATEADD(SECOND, cast(569337307200000 as bigint) / 1000, '19700101'))
Run Code Online (Sandbox Code Playgroud)
我在SQL Server 2008上运行它.
c# ×7
wcf ×3
.net ×2
asp.net ×1
e4x ×1
flash ×1
http ×1
json ×1
messagebox ×1
rest ×1
routing ×1
sql ×1
strongname ×1
system-tray ×1
unmanaged ×1
url-encoding ×1
wcf-web-api ×1
winforms ×1
xml ×1