我正在尝试使用FW4.0构建WCF应用程序服务.在服务器和客户端之间传输EntiryFramework对象时,我的服务正常工作.但是我在将EF对象从客户端传递到服务器时遇到问题.
这里有关于我的环境的一些更多细节: - 服务在IIS本地调试模式下运行 - 我在Windows 7上运行所有这些 - 我在FW4.0上使用Visual Studio 2010
我正在尝试将一个对象(tblClient)发送到服务器以保存记录,但是保持错误(413)请求实体太大.这里是完整的堆栈:
System.ServiceModel.ProtocolException occurred
HResult=-2146233087
Message=The remote server returned an unexpected response: (413) Request Entity Too Large.
Source=mscorlib
StackTrace:
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Code First Entity框架,在ASP Core 1,RC2项目中构建数据库.
我收到此错误消息:
键{'TempId'}包含阴影状态的属性,并由'TaskStatus'到'TaskRunner.IsRunning'之间的关系引用.为此关系配置非阴影主键.
任何人都知道这个错误意味着什么?
请注意,我没有ny列名tempId.我是客人,EF7为自己构建这个专栏.
这是我的实体
public class TaskStatus
{
public Guid TaskConfigId { get; set; }
public string LastResultValue { get; set; }
public int RetryCount { get; set; }
public TaskStatusEnum StatusEnum { get; set; }
public DateTimeOffset LastUpdate { get; set; }
public TaskResult TaskResult { get; set; }
public TaskStatusEnum TaskStatusEnum { get; set; }
}
public class TaskRunner
{
public DateTimeOffset RunAt { get; set; }
public TaskConfig TaskConfig { get; …Run Code Online (Sandbox Code Playgroud) 我是Entity Framework的新手,我认为这里有一些我误解的东西.我试图在表中插入一行,并且在我找到代码示例的任何地方,他们调用方法InsertOnSubmit(),但问题是我找不到方法InsertOnSubmit或SubmitChanges.
错误告诉我:System.Data.Object.ObjectSet不包含InsertOnSubmit的定义,...
我做错了什么?
http://msdn.microsoft.com/en-us/library/bb763516.aspx
GMR_DEVEntities CTX;
CTX = new GMR_DEVEntities();
tblConfig Config = new tblConfig { ID = Guid.NewGuid(), Code = "new config code" };
CTX.tblConfigs.InsertOnSubmit(Config); // Error here
Run Code Online (Sandbox Code Playgroud)
编辑:在FW 4.0上使用Visual Studio 2010
我最近安装了.NET Core 1.0 RC2,我知道命令DNX已经改为dotnet.exe命令,但是我知道无法找到如何创建新的EF7 Migration文件.无论我尝试"dotnet ef"命令,我都会得到
dotnet : No executable found matching command "dotnet-ef"
At line:1 char:1
+ dotnet ef
+ ~~~~~~~~~
+ CategoryInfo : NotSpecified: (No executable f...and "dotnet-ef":String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Run Code Online (Sandbox Code Playgroud)
类似的东西,如果尝试VS PS控制台内的"添加迁移"命令,那就给我这个:
Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At …Run Code Online (Sandbox Code Playgroud) c# entity-framework ef-migrations visual-studio-2015 .net-core-rc2
我目前正在尝试构建一个PowerShell脚本,需要将我自己的C#应用程序作为服务启动,然后我需要检查事件日志中的错误或其他条目.但是一旦完成了dotnet运行任务,该进程就不会让我运行另一个命令,它会等待启动进程停止.
这是PowerShell脚本的一个示例
CD C:\MyCSharpProject\Project\
dotnet run --debug <# script stop after this command is run, and the next command is not run r#>
notepad <# This line is never hit #>
Run Code Online (Sandbox Code Playgroud)
如何启动我的服务然后再运行另一个命令?
有没有办法查询另一个LINQ查询?
我有一个包含LINQ表达式结果的BindingSource对象.并且BindingSource是DataGridView的DataSource.
现在我想进一步过滤BindingSource的结果.
有没有办法将BindingSource数据源转换为我可以查询的东西?
我是我的第一个Windows应用商店应用程序,我遇到了反序列化/加载我的应用程序数据的问题.
我正在使用JSon将我的类对象序列化为字符串,然后我将其保存到Application Local App文件夹.
当需要加载数据时,曾几何时加载在运行时失败,并且没有加载数据.我的类被实例化为一个新类.
但是,当我运行我的代码时,我步进调试模式.Desirialization工作正常,我的类正确加载.
我认为问题来自我的异步实现.但我不知道在哪里.
有人能帮我吗?
保存程序:
public virtual void Save()
{
var data = JsonConvert.SerializeObject(this);
WriteTotextFileAsync("Cashier.Data.Config", data);
}
public static async void WriteTotextFileAsync(string fileName, string contents)
{
var folder = ApplicationData.Current.LocalFolder;
var file = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
await FileIO.WriteTextAsync(file, contents);
}
Run Code Online (Sandbox Code Playgroud)
装载程序:
private async void LoadConfig()
{
string data;
if (Config == null)
{
data = await ReadTextFileAsync("Cashier.Data.Config");//.ConfigureAwait(false);
if (data != null && data.Length > 0)
try
{
System.Diagnostics.Debug.WriteLine(data);
Config = JsonConvert.DeserializeObject<Data.Config>(data);
System.Diagnostics.Debug.WriteLine(data);
}
catch (Exception ex) …Run Code Online (Sandbox Code Playgroud) c# ×6
linq ×2
async-await ×1
linq-to-sql ×1
powershell ×1
service ×1
vb.net ×1
wcf ×1
winforms ×1
wpf ×1