日期:2014-05-20  浏览次数:20555 次

使用c#和asp.net进行网站开发,看到以下错误,不知道错误原因和错误位置
我刚开始用c#进行开发,以前没有接触过.net,现在碰到一些问题,希望网上的大侠能帮我解答一下。
        我们的网站需要在后台调用一个用c编写的dll,调用的时候没有问题,也返回数据了。但现在的问题是,如果有两个不同的网页先后调用这个dll的话,第二个网页会弹出以下错误:

路径中具有非法字符。  
说明:   使用   CodeDomProvider“Microsoft.CSharp.CSharpCodeProvider”进行编译的过程中发生未处理的异常。请检查堆栈跟踪,了解有关此错误以及代码中发生此错误的位置的详细信息。  

异常详细信息:   System.ArgumentException:   路径中具有非法字符。

源错误:  

执行当前   Web   请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。    

堆栈跟踪:  


[ArgumentException:   路径中具有非法字符。]
      System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[]   str)   +276
      System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess   access,   String[]   pathListOrig,   Boolean   checkForDuplicates,   Boolean   needFullPath,   Boolean   copyPathList)   +88
      System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess   access,   String[]   pathList,   Boolean   checkForDuplicates,   Boolean   needFullPath)   +43
      System.IO.Directory.GetCurrentDirectory()   +205
      System.Environment.get_CurrentDirectory()   +5
      System.CodeDom.Compiler.Executor.ExecWaitWithCapture(IntPtr   userToken,   String   cmd,   TempFileCollection   tempFiles,   String&   outputName,   String&   errorName,   String   trueCmdLine)
      System.CodeDom.Compiler.CodeCompiler.Compile(CompilerParameters   options,   String   compilerDirectory,   String   compilerExe,   String   arguments,   String&   outputFile,   Int32&   nativeReturnValue,   String   trueArgs)
      System.CodeDom.Compiler.CodeCompiler.FromFileBatch(CompilerParameters   options,   String[]   fileNames)
      System.CodeDom.Compiler.CodeCompiler.FromDomBatch(CompilerParameters   options,   CodeCompileUnit[]   ea)
      System.CodeDom.Compiler.CodeCompiler.FromDom(CompilerParameters   options,   CodeCompileUnit   e)
      System.CodeDom.Compiler.CodeCompiler.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromDom(CompilerParameters   options,   CodeCompileUnit   e)
      System.Web.Compilation.BaseCompiler.GetCompiledType()

 


--------------------------------------------
版本信息:   Microsoft   .NET   Framework   版本:1.1.4322.573;   ASP.NET   版本:1.1.4322.573  


从这个错误看不出原因,也看不到出错的位置。有没有同仁,碰到相同的问题。

这个错误而且有点奇怪,如果这个网页出过一次错以后,下次访问还是会出现同样的问题,但是如果在服务中停止“World   Wide   Web   Publishing”服务,再重新起动以后,然后再访问这个网页,就又正常了(当然是作为第一个调用dll的网页打开)。

另外在dll中,由于没有全局变量和静态变量,应该不存在多线程问题。但这个问题肯定跟调用dll有关。

------解决方案--------------------
我觉得应该是你的DLL的问题,如果你的DLL有代码的话,可以检查一下你的代码~~~~

如果你肯定不是你的DLL的问题,那就检查一下你的调用此DLL的程序是不是有问题。
------解决方案--------------------
关注这个问题,也许以后也会遇到