我写了一个webpart和一个exe程序,用同样的代码用同样的代码去调用另一个exe程序“Importer”:System.Diagnostics.Process pImporter = new System.Diagnostics.Process();  pImporter.StartInfo.FileName=@"C:\Program Files\Importer"; //调用“Importer”
strImporter=@"-folder e:\SPS -root http://test/site/net/viewlsts.aspx?BaseType=0 -        CreateListTemplates False -OKToImportToExistingSite False                       -        OKToImportToExistingLibrary True -ImportSecurity False -ImportDesign False      -     reportLevel Information"; //参数

pImporter.StartInfo.Arguments=strImporter;
pImporter.Start();
if(pImporter.HasExited)
     pImporter.Kill(); 结果webpart运行正常,而exe程序运行结果不正确。我怀疑是参数strImporter里面有网址,或者某些特殊字符,导致运行不成功的。请教哪位高手能看出问题?谢谢。

解决方案 »

  1.   

    有出错日志:Starting the import...
    Site creation failed (site=http___test_sites_net_viewlsts.aspx_BaseType_0). Error: Cannot connect to the configuration database.
    Could not create the site http___test_sites_net_viewlsts.aspx_BaseType_0 last logger error : "Site creation failed (site=http___test1_sites_net_viewlsts.aspx_BaseType_0). Error: Cannot connect to the configuration database." see log.txt for more details
    Added 0 documents
    Added 0 list items
    All done!
    See import06160929.log for more info
      

  2.   

    try catch finnally再定义个跟踪变量看看.
    如果你怀疑是特殊字符的原因,全改成转义字符串试试
      

  3.   

    我在参数里面已经:
    strImporter=@"-folder e:\SPS -root http://test/site/net/viewlsts.aspx?…………加了@号在前面。主要是我看到日志的第二行:Site creation failed (site=http___test_sites_net_viewlsts.aspx_BaseType_0). 这个site怎么会变成这样了呢?
      

  4.   

    site=http___test_sites_net_viewlsts.aspx_BaseType_0
    -------------------------------------------------------
    应该是http地址中的特殊符号没有识别出来,转义后再试试
      

  5.   

    to:lemong(風之影) 
    怎么转义? 
      

  6.   

    有出错日志:
    Fail gracefully: Invalid URI: The format of the URI could not be determined.
    Invalid URI: The format of the URI could not be determined.
       at System.Uri.Parse()
       at System.Uri..ctor(String uriString, Boolean dontEscape)
       at System.Uri..ctor(String uriString)
       at Microsoft.SharePoint.SPSite.a(String A_0, SPVirtualServer A_1, a A_2, Int32 A_3)
       at Microsoft.SharePoint.SPSite..ctor(String strUrl)
       at SharePointExtractor.Extractor.Process(DataSet parameters)
    Extracted: 0 list items and 0 documentsDone