SDE操作的許可問題

2021-09-22 17:25:45 字數 1567 閱讀 2917

arcgis二次開發和arcgis桌面應用中,許可是乙個老生常談的問題。以前也小結過一些經驗。參考:

直接來先看報錯的**:

這是很普通的連線sql server sde的**操作,

/// /// 獲取工作空間

public static iworkspace getworkspace(ipropertyset ppropertyset)

// 建立 sde 工作空間工廠,並開啟工作空間

//type factorytype = type.gettypefromprogid("esridatasourcesgdb.sdeworkspacefactory");

//var workspacefactory = (iworkspacefactory)activator.createinstance(factorytype);

iworkspacefactory workspacefactory = new sdeworkspacefactoryclass();

iworkspace workspace = workspacefactory.open(ppropertyset, 0);

return workspace;

}/// /// 轉換成屬性設定

///

public static ipropertyset gepropertyset()

", "伺服器ip"));

ppropertyset.setproperty("database", "資料庫名稱");

ppropertyset.setproperty("user", "sa");

ppropertyset.setproperty("password", "密碼");

"version", "sde.default");

ppropertyset.setproperty("authentication_mode", "dbms");

return ppropertyset;

}

經測試sde連線引數正常,可在open方法時,報錯"the product license has not been initialized"(產品許可未初始化),程式是用**初始化許可的,執行繫結desktop,產品許可類別是advanced(高階版)

在相同的環境下,另外一套程式又可以,比較兩者的不同,似乎與mapcontrol控制項存在某種關聯,經反覆測試,得出以下結果:使用ao的sample作對比,只要是先拖放mapcontrol控制項,**就不會報許可問題(先拖放許可、或不拖mapcontrol都不行)。

暫時是解決了這個問題,我們姑且認為是10.4的bug,雖然沒有使用mapcontrol,但也拖放了這個控制項(隱藏)。

我一直在想,既然它都能報這個錯,肯定不是什麼bug,而不是我們不知道錯在**,經過一番測試,最終於不是通過許可方式解決它了。即在**初始化許可是除了新增advanced許可,還新增了arcserver許可

ArcEngine10 x開發的許可問題

1.arcengine9.x遷至arcengine10.x 相信很多同學都知道,在arcengine9.x下正常編譯的 到arcengine10.x會報錯 arcgis version not specified.you must call runtimemanager.bind before cr...

ArcEngine10 x開發的許可問題

1.arcengine9.x遷至arcengine10.x 相信很多同學都知道,在arcengine9.x下正常編譯的 到arcengine10.x會報錯 arcgis version not specified.you must call runtimemanager.bind before cr...

ABAQUS和UG許可證衝突問題的解決方案

前段時間重新安裝了abaqus,更新到了2020版本後,發現nx ug怎麼突然打不開了,搜尋一下,發現是兩個許可證有衝突。找了很多解決方案,主要歸納為以下兩種 先說結論 這個方法最後導致的結果就是兩個軟體其實是共用的乙個lmtools,你修改其中乙個,另乙個就用不了了,每次使用都需要重新調換,比較麻...