English 中文(简体)
错误5无法将文件“log.lodf”复制到“binlog.ldf”。该进程无法访问该文件,因为它正被其他进程使用
原标题:Error 5 Unable to copy file " log.ldf" to "binlog.ldf". The process cannot access the file as it is used by other process

I recently installed MS SQL Server 2012. I thought it would be a great database software. But after 2 days trail, I found it is not that good as what I thought.

As you can see, every time when I run my project from VS 2010, VS always complains of the .ldf file is being used by another process.(which is the SQL Server 2012) And then I have to disable the SQL Server service from the Service in the Computer Management, so the program can be compiled successfully.

But when the project is running, it requires the SQL Server service running, as some code needs to get access to the database and modify data. Then I have to enable the SQL service.

It s really annoying. It didn t perform like this when I was using SQL Server 2008.

那么,有什么可能的解决方案吗?

我确实尝试在web.config文件中添加配置片段。

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.web>
    <hostingEnvironment shadowCopyBinAssemblies="false"/>
  </system.web>
</configuration>

And then I clean the whole solution and rebuild the whole solution, errors remain.

我非常期待尽快看到解决方案。

最佳回答

Probably your solution contains a reference to the LDF file.
And by mistake the Copy to the Output directory is flagged as Copy always or Copy if Newer.

当然,SQL Server经常使用LDF文件(日志文件),因此在编译时会出现所描述的错误。

您不需要引用此文件,因此可以从标记的解决方案中删除Copy Never

问题回答

暂无回答




相关问题
Best practices for Subversion and Visual Studio projects

I ve recently started working on various C# projects in Visual Studio as part of a plan for a large scale system that will be used to replace our current system that s built from a cobbling-together ...

Enable PHP highlights in VS 2010?

I ve heard that Visual Studio 2010 Beta 2 has support for PHP. When I load a PHP file though, it has nothing highlighted and is nothing more than a glorified text editor. Is there a way to enable it?...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

Unit Testing .NET 3.5 projects using MStest in VS2010

There s a bug/feature in Visual Studio 2010 where you can t create a unit test project with the 2.0 CLR. https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=483891&wa=...

热门标签