首先我会道歉,因为这可能是重复的,但我读到的所有内容似乎都不完整或令人困惑,因为我对WCF很新.
我基本上希望在IIS中部署一个WCF服务,可以访问2个端点,并且整天都在圈子里走动:(
我有一个服务库WCF DLL具有以下结构
App.config
TestSvc1.cs
ITestSvc1.cs
TestSvc2.cs
ITestSvc2.cs
Run Code Online (Sandbox Code Playgroud)
这在VS WCF测试客户端中运行良好,现在我正在部署到IIS,因此我创建了一个WCF服务应用程序并引用了dll.该项目具有以下结构
Service1.svc
Web.config
Run Code Online (Sandbox Code Playgroud)
Service1.svc 包含这个
<%@ ServiceHost Language="C#" Debug="true"
Service="WCFServices.TestServices.ITestSvc1" CodeBehind="Service1.svc.cs" %>
Run Code Online (Sandbox Code Playgroud)
我web.config有以下几点
<services>
<service name="WCFServices.TestServices.TestSvc2">
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="LargeSizeMessages"
contract="WCFServices.TestServices.ITestSvc2">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/wcf2/TestServices/TestSvc2/" />
</baseAddresses>
</host>
</service>
<service name="WCFServices.TestServices.TestSvc1">
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="LargeSizeMessages"
contract="WCFServices.TestServices.ITestSvc1"
listenUri="http://localhost:8080/wcf2/service1.svc">
<identity>
<dns value="" />
</identity>
</endpoint>
<endpoint
address=""
binding="wsHttpBinding" bindingConfiguration="LargeSizeMessages"
contract="WCFServices.TestServices.ITestSvc2"
listenUri="http://localhost:8080/wcf2/service1.svc">
<identity>
<dns value="" />
</identity>
</endpoint>
<endpoint address="mex" …Run Code Online (Sandbox Code Playgroud) 这里很复杂,反正对我来说:)
基本上我想要实现的是生成一些文本,将这个文本文件压缩到两个目录中,然后将其上传到MySQL blob字段 - 所有这些都没有写入磁盘.我对这一切都比较新,所以任何指针都非常感激.到目前为止,我有点放在一起,它显然崩溃和烧伤,但希望能更好地了解我喜欢做什么.哦,我现在使用DotNetZip :)
public void broadcastItem()
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
System.IO.StreamWriter sw = new System.IO.StreamWriter(ms);
System.IO.MemoryStream ms2 = new System.IO.MemoryStream();
sw.Write("Some Text generated and placed in a file");
sw.Close(); //Text File Now Created
using (ZipFile zip = new ZipFile())
{
zip.AddDirectory(@"Directory1\Directory2");
//Zipping within two directories
ZipEntry e = zip.AddEntry("Test", ms);
e.
e.Comment = "The content for entry in the zip file was obtained from a stream";
zip.Comment = "This zip was created at " + …Run Code Online (Sandbox Code Playgroud) 嗨,我对java很新,这是我使用GUI的第一部作品.基本上我有一些代码来创建一个网格,但我需要的是两个网格并排显示在屏幕上以用于一个batteships游戏,我对网格的代码是下面任何人可以帮助我放另一个单独的实例这个在同一个屏幕上?
/**
BattleGui:
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
public class BattleGui implements ActionListener
{
// Default filename to use for saving and loading files
// Possible improvement: replace with a FileChooser
private final static String DEFAULT_FILENAME = "battlegui.txt";
private int GRID_SIZE = 8;
private JButton [] buttonArray;
public JMenuBar createMenu()
{
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Battle Menu");
JMenuItem menuItem;
menuBar.add(menu);
// A group of JMenuItems. You can create other menu items …Run Code Online (Sandbox Code Playgroud) 我创建了一个应用程序,它基本上在 mysql 服务器上查找 blob 记录,我遇到的问题是,如果无论出于何种原因 blob 字段为空,应用程序都会崩溃。我想过类似的事情
我目前有
byte[] data = (byte[])DbReader[2];
Run Code Online (Sandbox Code Playgroud)
但我想知道是否有任何方法可以做类似的事情
if (DbReader.IsDbNull(2)
byte[] data = /* DEFAULT VALUE */
else
byte[] data = (byte[])DbReader[2];
Run Code Online (Sandbox Code Playgroud)
但是我可以设置一个默认值吗??我尝试过的一切都失败了:(
我有一个奇怪的问题,基本上我有一个使用会话的购物车.当我使用IIS7部署网站时,一切看起来都很好.我在一台电脑上为会话添加了一个产品,它显示在我的购物篮中.当我从另一台PC访问该网站时,篮子里面有这个项目!! ??
我的理解是每个用户浏览器的会话实例是唯一的这是正确的吗?如果是这样,我怎么设法做到这一点?我知道它可能是一些愚蠢但我无法弄清楚,任何帮助非常感谢!
我的会话购物车代码如下
#region Singleton Implementation
public static readonly ShoppingCart Instance;
static ShoppingCart()
{
// If the cart is not in the session, create one and put it there
// Otherwise, get it from the session
if (HttpContext.Current.Session["sCart"] == null)
{
Instance = new ShoppingCart();
Instance.Items = new List<CartItem>();
HttpContext.Current.Session["sCart"] = Instance;
}
else
{
Instance = (ShoppingCart)HttpContext.Current.Session["sCart"];
}
}
protected ShoppingCart() { }
#endregion
Run Code Online (Sandbox Code Playgroud) 基本上我有一个带有runat服务器标签的表单.在这个形式我有一个asp转发器和asubmit按钮 - 但我也想有一个按钮,将在我的代码中调用ac#方法 - 有人可以请你告诉我如何去做这个?同样在这段代码中,selectindexchanged事件即使其autopostback值为true也不会触发,这很奇怪:/
谢谢
编辑 确定解决方案似乎是删除操作选项卡,然后我通过一些JavaScript设置属性而不是:)为什么不能直截了当
<form action="broadcast.aspx" id="bcForm" runat="server" onsubmit="chkChecks()">
<a class="btn btn-warning" href="#" title="Create new product"> <i class="icon-plus icon-white"></i> Create new product</a>     <a id="bcItems" data-toggle="modal" class="btn btn-primary" title="Broadcast" onclick="chkItems()"><i class="icon-share icon-white"></i> Broadcast</a>
</br></br>
<p>Filters:
<asp:DropDownList ID="groupFilter" runat="server" ToolTip="Groups" AutoPostBack="True" onselectedindexchanged="groupFilter_SelectedIndexChanged1" ></asp:DropDownList></p>
<div>
<asp:Repeater ID="DepartmentList" runat="server" OnItemmDataBound="DepartmentsList_ItemDataBound">
<HeaderTemplate>
<table id="grouptable" class="table table-bordered table-striped sortable">
<thead>
<tr>
<th class="sorttable_nosort" >Broadcast
<br> </br><a class="label label-inverse" onclick="checkAll()">Check All</a> <a class="label label-inverse" onclick="uncheckAll()">Uncheck All</a></th>
<th class="sorttable_numeric">ID</th>
<th>Name</th>
<th>Last Modified</th>
<th>Actions</th> …Run Code Online (Sandbox Code Playgroud) 我需要使用带有绘图库的 Google 地图中的多边形在特定区域内定义一些区域。
我几乎已经有了框架,但我注意到有时我的多边形的顺序并不像我期望的那样。
我对我的第一个多边形使用了 999999999 的 zIndex 属性,并在绘制其他多边形时减小该值,其想法是第一个区域是最小的,其他区域在此范围之外 - 并且通过这种设置,较小的多边形应该仍然是可选的.
我的问题是,这有时会起作用,但是尽管 zIndex 值较低,但它会排出一些更大的更远的区域,它覆盖在我的其他多边形之上
任何人都可以看到我哪里出错了,或者是否有另一种方法可以做到这一点,因为 zIndex 并不总是适用。
这是一个示例 sahpe 初始化
google.maps.event.addListener(drawingManager, 'overlaycomplete', function(e) {
zVal = zVal-1000000;
if (e.type != google.maps.drawing.OverlayType.MARKER) {
// Switch back to non-drawing mode after drawing a shape.
drawingManager.setDrawingMode(null);
// Add an event listener that selects the newly-drawn shape when the user
// mouses down on it.
var newShape = e.overlay;
//Check to see if the shape has an id if not alert user to pick …Run Code Online (Sandbox Code Playgroud) javascript google-maps polygon google-maps-api-3 google-maps-drawing
我目前在将ms sql表中的字符串字段转换为所需的日期格式时遇到问题。
以前我一直用
CONVERT(date,c.INP_DATE ,103)
Run Code Online (Sandbox Code Playgroud)
但这给了我错误
[Err] 22007 - [SQL Server]Conversion failed when converting date and/or time from character string.
Run Code Online (Sandbox Code Playgroud)
我有两个示例记录是2013-09-18和2013-09-18 17:17:32.0000000这是我从通过mysql导入导入。我需要在适当的时候将它们转换为dd / mm / yyyy。
任何大师的帮助都值得赞赏:)
c# ×4
asp.net ×3
mysql ×2
blob ×1
button ×1
byte ×1
bytearray ×1
c#-4.0 ×1
date ×1
form-submit ×1
google-maps ×1
java ×1
javascript ×1
layout ×1
polygon ×1
session ×1
sql-server ×1
streamwriter ×1
swing ×1
t-sql ×1
wcf ×1
wcf-binding ×1
zip ×1